automatic commit
[folded-ctf.git] / pi_feature.h
diff --git a/pi_feature.h b/pi_feature.h
new file mode 100644 (file)
index 0000000..b03a922
--- /dev/null
@@ -0,0 +1,86 @@
+
+///////////////////////////////////////////////////////////////////////////
+// This program is free software: you can redistribute it and/or modify  //
+// it under the terms of the version 3 of the GNU General Public License //
+// as published by the Free Software Foundation.                         //
+//                                                                       //
+// This program is distributed in the hope that it will be useful, but   //
+// WITHOUT ANY WARRANTY; without even the implied warranty of            //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      //
+// General Public License for more details.                              //
+//                                                                       //
+// You should have received a copy of the GNU General Public License     //
+// along with this program. If not, see <http://www.gnu.org/licenses/>.  //
+//                                                                       //
+// Written by Francois Fleuret, (C) IDIAP                                //
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
+///////////////////////////////////////////////////////////////////////////
+
+/*
+
+  This class implement the notion of pi-feature, that is a feature
+  which can be evaluated on a pair image / referential, where the
+  referential is computed from a pose cell.
+
+*/
+
+#ifndef PI_FEATURE_H
+#define PI_FEATURE_H
+
+#include "misc.h"
+#include "global.h"
+#include "rich_image.h"
+#include "pi_referential.h"
+
+class PiFeature {
+
+  enum {
+    PF_EDGE_THRESHOLDING,
+    PF_EDGE_HISTOGRAM_COMPARISON,
+    PF_GRAYSCALE_HISTOGRAM_COMPARISON,
+  } _type;
+
+  int _tag, _edge_scale;
+  Rectangle _window_a, _window_b;
+  int _registration_a, _registration_b;
+
+  int random_registration_mode(int level);
+  void randomize_window(int registration_mode, Rectangle *window);
+  void draw_window(RGBImage *image, int registration_mode, Rectangle *window);
+
+  // EDGE THRESHOLDING
+
+  scalar_t response_edge_thresholding(RichImage *image, PiReferential *referential);
+  void draw_edge_thresholding(RGBImage *image, int r, int g, int b,
+                              PiReferential *referential);
+  void print_edge_thresholding(ostream *os);
+
+  // EDGE ORIENTATION HISTOGRAM COMPARISON
+
+  scalar_t response_edge_histogram_comparison(RichImage *image, PiReferential *referential);
+  void draw_edge_histogram_comparison(RGBImage *image, int r, int g, int b,
+                                      PiReferential *referential);
+  void print_edge_histogram_comparison(ostream *os);
+
+  // GRAYSCALE HISTOGRAM COMPARISON
+
+  scalar_t response_grayscale_histogram_comparison(RichImage *image, PiReferential *referential);
+  void draw_grayscale_histogram_comparison(RGBImage *image,
+                                           int r, int g, int b,
+                                           PiReferential *referential);
+  void print_grayscale_histogram_comparison(ostream *os);
+
+public:
+
+  void randomize(int level);
+
+  scalar_t response(RichImage *image, PiReferential *referential);
+
+  void draw(RGBImage *image,
+            int r, int g, int b,
+            PiReferential *referential);
+
+  void print(ostream *os);
+};
+
+#endif