automatic commit
[folded-ctf.git] / pose_cell_hierarchy.h
diff --git a/pose_cell_hierarchy.h b/pose_cell_hierarchy.h
new file mode 100644 (file)
index 0000000..51f4e6e
--- /dev/null
@@ -0,0 +1,66 @@
+
+///////////////////////////////////////////////////////////////////////////
+// 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        //
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef POSE_CELL_HIERARCHY_H
+#define POSE_CELL_HIERARCHY_H
+
+#include "pose_cell_set.h"
+#include "labelled_image_pool.h"
+
+struct RelativeBodyPoseCell {
+  Interval _body_xc, _body_yc, _body_radius_1, _body_radius_2, _body_tilt;
+};
+
+class PoseCellHierarchy {
+  static const scalar_t pseudo_infty = 10000;
+
+  static const scalar_t body_resolution = 0.5;
+
+  static const int nb_radius_1 = 16;
+  static const int nb_radius_2 = 16;
+  static const int nb_tilts = 64;
+
+  int _nb_levels;
+  scalar_t _min_head_radius;
+  scalar_t _max_head_radius;
+  int _root_cell_nb_xy_per_scale;
+
+  int _nb_body_cells;
+
+  RelativeBodyPoseCell *_body_cells;
+
+public:
+  PoseCellHierarchy();
+  PoseCellHierarchy(LabelledImagePool *train_pool);
+  virtual ~PoseCellHierarchy();
+
+  virtual int nb_levels();
+  virtual void get_containing_cell(Image *image, int level,
+                                   Pose *pose, PoseCell *result_cell);
+
+  virtual void add_root_cells(Image *image, PoseCellSet *cell_set);
+  // level is the level to build, hence should be greater than 1
+  virtual void add_subcells(int level, PoseCell *root, PoseCellSet *cell_set);
+
+  virtual int nb_incompatible_poses(LabelledImagePool *pool);
+
+  virtual void write(ostream *os);
+  virtual void read(istream *is);
+};
+
+#endif