ProbMultiRegStereoCam3D.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010  Antonio Franchi
00006 //
00007 // This file is part of TeleKyb.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00029 #ifndef __PROB_MULTI_REG3D_STEREO_CAM_H_
00030 #define __PROB_MULTI_REG3D_STEREO_CAM_H_
00031 
00032 #define BLACK "\e[2;30m"
00033 #define RED "\e[0;31m"
00034 #define GREEN "\e[0;32m"
00035 #define YELLOW "\e[0;33m"
00036 #define BLUE "\e[0;34m"
00037 #define MAGENTA "\e[0;35m"
00038 #define CYAN "\e[0;36m"
00039 #define WHITE "\e[0;37m"
00040 #define STOPCOLOR "\e[m"
00041 
00042 #include <MIPMatrix.h>
00043 #include "time.h"
00044 #include <fstream>
00045 #include <stdlib.h>
00046 #include <stdio.h>
00047 #include <vector>
00048 #include <iostream>
00049 #include <R2.h>
00050 #include <S1.h>
00051 #include <SE2.h>
00052 #include "ProbMultiRegStereoCam3DStr.h"
00053 #include "ProbMultiRegCam3D.h"
00054  
00055 using namespace std;
00056 using namespace MipBaselib;
00057  
00058 namespace kybalg{
00059  
00063  class probMultiRegStereoCam3DQuadSol: public MIPObject {
00064  private:
00066   vector<probPolFusionDist*> _sols;
00067   
00068  public:
00070   probMultiRegStereoCam3DQuadSol();
00071   
00073   probMultiRegStereoCam3DQuadSol(probPolFusionDist *polFusion);
00074   
00076   ~probMultiRegStereoCam3DQuadSol();
00077   
00079   void insertPol(probPolFusionDist *polFusion);
00080   
00082   int getSize();
00083   
00085   probPolFusionDist* getProbPolFusion(int pos);
00086   
00088   vector<probPolFusionDist*> getActualSol();
00089   
00091   probMultiRegStereoCam3DQuadSol& operator=(probMultiRegStereoCam3DQuadSol &A);
00092   
00094   int searchId(int id, vector<Pose3D> *ris, vector<MIPMatrix> *measCov, Decimal *rightProb, vector<Decimal> *weights);
00095   
00097   string printSolutions(vector<Pose3D> *ris);
00098   
00100   string print(int opt = 0);
00101   
00103   string getObjectName() const{
00104    return "probMultiRegStereoCam3DQuadSol";
00105   }
00106   
00107  };
00108  
00112  class probMultiRegStereoCam3DCam : public MIPObject {
00113  private:
00114   // Map that links id with actual belief (from motion update blocks of particle filters)
00115   map <int, vector<Pose3D> > *likelihood;
00116   // List of ids of activated filters
00117   vector <int> activeLikelihoods;
00118   
00119  public:
00121   ProbMultiRegCam3DQuadPar _par;
00122   
00124   probMultiRegStereoCam3DCam(ProbMultiRegCam3DQuadPar par);
00125   
00127   ~probMultiRegStereoCam3DCam();
00128   
00130   void initExample(vector<bearDistId> &input);
00131   
00133   void print(vector<bearDistId> input, int option);
00134   
00136   void print(vector< vector<Decimal> > input);
00137   
00139   void initTriangles(vector<bearDistId> &input, probMultiRegStereoCam3DQuadSol *mrcsols, int myId);
00140   
00142   vector <vector<Angle> > createAng(vector<vector<Angle> > input);
00143   
00145   void evalTria(vector<bearDistId> &input,int firstV,int firstF,int firstS,int secondV,int secondF,int secondS,int thirdV,int thirdF,int thirdS,triangleAssObs *triaPointer);
00146   //void evalTria(vector<bearDistId> input, Decimal firstV, Decimal firstF, Decimal firstS, Decimal secondV, Decimal secondF, Decimal secondS, Decimal thirdV, Decimal thirdF, Decimal thirdS, Decimal aSide, Decimal bSide, Decimal cSide, Triangle *triaPointer);
00147   //void evalTria(vector<bearDistId> input,Decimal firstV,Decimal secondV,Decimal thridV,Decimal aSide,Decimal bSide,Decimal cSide,Triangle *triaPointer);
00148   
00150   int step(int argc, char** argv);
00151   
00153   void eraseDup(triangleAssObs* triaPointer, Decimal thr);
00154   
00156   void eraseDup3(triangleAssObs* triaPointer, Decimal thr);
00157   
00159   void eraseDup2(triangleAssObs* triaPointer, Decimal thr);
00160   
00162   bool eraseDupTria(vector<triangleAssObs*> &trias, triangleAssObs* &tria);
00163   
00165   void createPol(vector<triangleAssObs*> triaSols, int myId,probMultiRegStereoCam3DQuadSol *mrcsols);
00166   
00168   void quickSortTria(vector<triangleAssObs*> &triaSols, triangleAssObs* &tria, int myId);
00169   
00171   void selectSubSol(vector<triangleAssObs*> &triaSols, triangleAssObs* &tria, int myId);
00172   
00174   void printDataIn(bearDistId* first,int f1,int f2, bearDistId* second, int s1, int s2, bearDistId* third, int t1, int t2,int info1,int info2, int info3, int id1, int id2, int id3);
00175   
00177   void setLikelihood(vector<int>& ids, map <int, vector<Pose3D> >* lik);
00178   
00180   string getObjectName() const {
00181    return "probMultiRegStereoCam3DCam";
00182   }
00183   
00184   // Variable used to print 
00185   fstream _logprobMultiRegStereoCam3DCamFile;
00186   fstream _logprobMultiRegStereoCam3DCamOutput;
00187  };
00188 }//end of namespace kybalg
00189 
00190 #endif

Generated on Mon Feb 20 07:01:06 2017 for MIP by  doxygen 1.5.6