*** empty log message ***
[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, (C) IDIAP                                //
16 // Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
17 ///////////////////////////////////////////////////////////////////////////
18
19 /*
20
21   This class implement the notion of pi-feature, that is a feature
22   which can be evaluated on a pair image / referential, where the
23   referential is computed from a pose cell.
24
25 */
26
27 #ifndef PI_FEATURE_H
28 #define PI_FEATURE_H
29
30 #include "misc.h"
31 #include "global.h"
32 #include "rich_image.h"
33 #include "pi_referential.h"
34
35 class PiFeature {
36
37   enum {
38     PF_EDGE_THRESHOLDING,
39     PF_EDGE_HISTOGRAM_COMPARISON,
40     PF_GRAYSCALE_HISTOGRAM_COMPARISON,
41   } _type;
42
43   int _tag, _edge_scale;
44   Rectangle _window_a, _window_b;
45   int _registration_a, _registration_b;
46
47   int random_registration_mode(int level);
48   void randomize_window(int registration_mode, Rectangle *window);
49   void draw_window(RGBImage *image, int registration_mode, Rectangle *window);
50
51   // EDGE THRESHOLDING
52
53   scalar_t response_edge_thresholding(RichImage *image, PiReferential *referential);
54   void draw_edge_thresholding(RGBImage *image, int r, int g, int b,
55                               PiReferential *referential);
56   void print_edge_thresholding(ostream *os);
57
58   // EDGE ORIENTATION HISTOGRAM COMPARISON
59
60   scalar_t response_edge_histogram_comparison(RichImage *image, PiReferential *referential);
61   void draw_edge_histogram_comparison(RGBImage *image, int r, int g, int b,
62                                       PiReferential *referential);
63   void print_edge_histogram_comparison(ostream *os);
64
65   // GRAYSCALE HISTOGRAM COMPARISON
66
67   scalar_t response_grayscale_histogram_comparison(RichImage *image, PiReferential *referential);
68   void draw_grayscale_histogram_comparison(RGBImage *image,
69                                            int r, int g, int b,
70                                            PiReferential *referential);
71   void print_grayscale_histogram_comparison(ostream *os);
72
73 public:
74
75   void randomize(int level);
76
77   scalar_t response(RichImage *image, PiReferential *referential);
78
79   void draw(RGBImage *image,
80             int r, int g, int b,
81             PiReferential *referential);
82
83   void print(ostream *os);
84 };
85
86 #endif