Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
activeSearch.hpp
Go to the documentation of this file.
00001 
00014 #ifndef ACTIVESEARCH_HPP_
00015 #define ACTIVESEARCH_HPP_
00016 
00017 #include "jmath/random.hpp"
00018 #include "jmath/jblas.hpp"
00019 #include "image/roi.hpp"
00020 
00021 #include "rtslam/gaussian.hpp"
00022 #include "rtslam/rtSlam.hpp"
00023 
00024 #include <iostream>
00025 
00026 namespace jafar {
00027   namespace rtslam {
00028     using namespace jblas;
00029 
00030 
00109     class ActiveSearchGrid {
00110 
00111         friend std::ostream& operator <<(std::ostream & s, ActiveSearchGrid const & grid);
00112 
00113       private:
00114         veci2 imgSize;
00115         veci2 gridSize;
00116         veci2 cellSize;
00117         veci2 offset;
00118         mati projectionsCount;
00119         mati emptyCellsTile_tmp;
00120         int separation;
00121         int margin;
00122         int cells_h;
00123       public:
00124         typedef std::vector<std::vector<observation_ptr_t> > Grid;
00125         Grid projections;
00126 
00127       public:
00136         ActiveSearchGrid(const int & imgSize_h, const int & imgSize_v, const int & nCells_h, const int & nCells_v, const int & margin = 0,
00137             const int & separation = 0);
00138 
00143         void clear();
00144 
00149         void renew();
00150 
00155         void addObs(const vec2 & pix, observation_ptr_t obsPtr);
00156 
00162         bool getRoi(image::ConvexRoi & roi);
00163 
00169         void setFailed(const image::ConvexRoi & roi);
00170 
00171         
00172       private:
00176         template<class Vec2>
00177         veci2 pix2cell(const Vec2 & pix) {
00178           veci2 cell;
00179           cell(0) = (pix(0) - offset(0)) / cellSize(0);
00180           cell(1) = (pix(1) - offset(1)) / cellSize(1);
00181           return cell;
00182         }
00183 
00187         veci2 cellOrigin(const veci2 & cell);
00188 
00192         vec2 cellCenter(const veci2 & cell);
00193 
00197         bool pickEmptyCell(veci2 & cell);
00198 
00202         void cell2roi(const veci2 & cell, image::ConvexRoi & roi);
00203 
00204     };
00205 
00206 #if 0
00207 
00211     class ActiveSearch {
00212       public:
00213         vecb visibleObs;
00214         vecb selectedObs;
00215 
00227         std::map<double, observation_ptr_t> projectAll(const sensor_ptr_t & senPtr, size_t & numVis);
00228 
00236         void predictApp(const observation_ptr_t & obsPtr);
00237 
00241         void scanObs(const observation_ptr_t & obsPtr, const image::ConvexRoi & roi);
00242     };
00243 #endif
00244   }
00245 }
00246 
00247 #endif /* ACTIVESEARCH_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:26 for Jafar by doxygen 1.7.6.1
LAAS-CNRS