X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=pose_cell_hierarchy.h;fp=pose_cell_hierarchy.h;h=51f4e6e492a686369904764dd6ef2dc4924268df;hb=d922ad61d35e9a6996730bec24b16f8bf7bc426c;hp=0000000000000000000000000000000000000000;hpb=3bb118f5a9462d02ff7d99ef28ecc0d7e23529f9;p=folded-ctf.git diff --git a/pose_cell_hierarchy.h b/pose_cell_hierarchy.h new file mode 100644 index 0000000..51f4e6e --- /dev/null +++ b/pose_cell_hierarchy.h @@ -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 . // +// // +// Written by Francois Fleuret, (C) IDIAP // +// Contact 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