PHDRansac.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
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 stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00029 
00030 #ifndef __PHD_RANSAC_H
00031 #define __PHD_RANSAC_H
00032 
00033 #include <Spaces.h>
00034 #include <armadillo>
00035 #include <math.h>
00036 #include <Gaussian.h>
00037 #include <GaussianMixture.h>
00038 #include <map>
00039 #include <Roulette.h>
00040 
00041 
00042 using namespace MipBaselib;
00043 using namespace arma;
00044 
00045 namespace MipAlgorithms{
00046  
00048  /* @{ */
00049  
00050  
00054  class PHDRansacIn{
00055   public:
00056    GaussianMixtureJointId gm1;
00057    GaussianMixtureJointId gm2;
00058    GaussianMixtureID gmA;
00059    GaussianMixtureID gmB;
00060    
00061    PHDRansacIn();
00062  };
00063  
00064  
00068  class PHDRansacOut{
00069   public:
00070    
00071    Pose relPose;
00072    bool valid;
00073    Decimal meanSquareError;
00074    int numInliers;
00075    
00076    PHDRansacOut();
00077  };
00078  
00082  class PHDRansacPars {
00083   
00084   public:
00085    
00086    int _trials;
00087    
00089    PHDRansacPars(int tr=1000);
00090    
00092    PHDRansacPars(const PHDRansacPars &p);
00093    
00095    const PHDRansacPars& operator=(const PHDRansacPars &p);
00096  };
00097  
00098  
00102  class PHDRansacVars {
00103   public:
00104    
00105    Decimal minSquareError;
00106    int maxInliers;
00107    
00108    map<int, vector<Decimal> > _sizeMap1;
00109    map<int, vector<int> > _idMap1;
00110    map<int, Roulette> _idRoulette1;
00111    vector<int> _ids1;
00112    vector<Decimal> _szId1;
00113    
00114    
00115    map<int, vector<Decimal> > _sizeMap2;
00116    map<int, vector<int> > _idMap2;
00117    map<int, Roulette> _idRoulette2;
00118    vector<int> _ids2;
00119    vector<Decimal> _szId2;
00120    
00121    vector<int> _commonIds;
00122    
00123    
00124    vector< Col<int>::fixed<2> > _associations;
00125    
00127    PHDRansacVars();
00128  };
00129  
00130  
00131  
00135  class PHDRansac {
00136   protected:
00137    PHDRansacVars* _vars;
00138    PHDRansacPars* _pars;
00139   public:
00140    PHDRansac();
00141    
00142    PHDRansac(PHDRansacPars &inParams);
00143    
00144    virtual PHDRansacOut step(PHDRansacIn &in);
00145    
00146    virtual string print();
00147    
00148   private:
00149    virtual void _gmprewarping(GaussianMixtureJointId &gm);
00150    
00151    virtual void _findIdMaps(GaussianMixtureJointId &gm, map<int,vector<int> > &idm, map<int,vector<Decimal> > &szm, vector<int> &ids);
00152    virtual void _findCommonIds();
00153    virtual void _buildRoulettes();
00154    virtual void _findBestAssociation(PHDRansacIn &in);
00155    virtual Pose _register(PHDRansacIn &in);
00156  };
00157  
00158  /* @} */
00159  
00160 }
00161 
00162 
00163 #endif
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 

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