voting_table.hh

00001 #ifndef __VOTING_TABLE_H
00002 #define __VOTING_TABLE_H
00003 
00004 #include <boost/smart_ptr.hpp>
00005 #include <boost/multi_array.hpp>
00006 #include <boost/numeric/ublas/vector.hpp>
00007 #include <map>
00008 #include <mimas/mm_image.h>
00009 #ifndef NDEBUG
00010 #include <mimas/mm_image_qtoutput.h>
00011 #endif
00012 #include <mimas/mm_object.h>
00013 #include <mimas/mm_xml_reference.h>
00014 #include <utility>
00015 #include <vector>
00016 #include "calibration.hh"
00017 #include "geometric_map.hh"
00018 #include "geometric_voting_statistics.hh"
00019 #include "mi_pose.hh"
00020 
00026 class voting_table: public mimas::mm_object
00027 {
00028  public:
00042   voting_table( const calibration_ptr &_calib,
00043                 const mimas::mm_xml_reference< XalanElement >
00044                 &geometricVotingNode, int _samplingRate, int _fringe,
00045                 short int minGradient, geometric_map_ptr _hash_map,
00046                 bool _verbose );
00060   std::vector< std::pair< mi_pose, double > > recognise
00061     ( const mimas::mm_image< bool > &scene_features,
00062       const std::vector< boost::numeric::ublas::vector< int > > &points,
00063       const mi_pose &poseInv,
00064       geometric_voting_statistics *statistic ) const;
00069   double get_z_resolution(void) const { return z_resolution; }
00072   geometric_map_ptr get_hash_map(void) const { return hash_map; }
00073  protected:
00080   mi_pose pose2d( const mi_pose &pose, int x, int y ) const;
00086   int pose_depth( const mi_pose &pose ) const;
00096   mi_pose pose3d( const mi_pose &pose, int x, int y, int z ) const;
00106   bool verification( const mimas::mm_image< bool > &scene_features,
00107                      const mi_pose &objectPose,
00108                      geometric_voting_statistics *statistic ) const;
00110   calibration_ptr calib;
00112   int sampling_rate;
00114   int fringe;
00117   double min_hits;
00122   double max_misses;
00126   int skip;
00130   double z_resolution;
00134   std::vector< std::vector< boost::numeric::ublas::vector< int > > >
00135     points_stack;
00138   int max_num_features;
00143   boost::multi_array< std::map< int, int >, 2 > hash_table;
00147   std::vector< mi_pose > candidates;
00150   geometric_map_ptr hash_map;
00152   bool verbose;
00153 #ifndef NDEBUG
00154 
00155   mutable mimas::mm_image_qtoutput< mimas::mm_rgba< unsigned char > > display;
00156 #endif
00157 };
00158 
00160 typedef boost::shared_ptr< voting_table > voting_table_ptr;
00161 
00162 #endif

doxygen-1.4.5 documentation for micron-vision - Tue Jan 17 15:29:15 2006