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