00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00029 #ifndef __PROB_MULTI_REG3D_H_
00030 #define __PROB_MULTI_REG3D_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 "ProbMultiRegCam3DStr.h"
00053
00054 using namespace std;
00055 using namespace MipBaselib;
00056
00057 namespace kybalg{
00061 class ProbMultiRegCam3DQuadPar {
00062 private:
00063
00064 Decimal _linearTollerance;
00065
00066 Decimal _angularTollerance;
00067
00068 Decimal _projTollerance;
00069
00070 Decimal _zenithTollerance;
00071
00072 int _expandMethod;
00073
00074 string _idPath;
00075
00076 string _bearMeasPath;
00077
00078 Decimal _minIntWeight;
00079
00080 public:
00082
00083
00085 ProbMultiRegCam3DQuadPar(Decimal lt=0.2, Decimal at=0.013962634+0.05, Decimal pt=0.1,Decimal zt=0.1,int expandMethod=2,Decimal miw=1.0,string idPath="Ids",string bmPath="UAVMeas");
00086
00088 ProbMultiRegCam3DQuadPar(const ProbMultiRegCam3DQuadPar &A);
00089
00091 ProbMultiRegCam3DQuadPar& operator=(ProbMultiRegCam3DQuadPar &A);
00092
00094 Decimal getLinearTollerance();
00095
00097 Decimal getAngularTollerance();
00098
00100 Decimal getProjTollerance();
00101
00103 Decimal getZenithTollerance();
00104
00106 int getExpandMethod();
00107
00109 string getIdPath();
00110
00112 string getBearMeasPath();
00113
00115 Decimal getMinIntWeight();
00116 };
00117
00121 class ProbMultiRegCam3DQuadSol: public MIPObject {
00122 private:
00124 vector<ProbPolFusion*> _sols;
00125
00126 public:
00128 ProbMultiRegCam3DQuadSol();
00129
00131 ProbMultiRegCam3DQuadSol(ProbPolFusion *polFusion);
00132
00134 ~ProbMultiRegCam3DQuadSol();
00135
00137 void insertPol(ProbPolFusion *polFusion);
00138
00140 int getSize();
00141
00143 ProbPolFusion* getProbPolFusion(int pos);
00144
00146 vector<ProbPolFusion*> getActualSol();
00147
00149 ProbMultiRegCam3DQuadSol& operator=(ProbMultiRegCam3DQuadSol &A);
00150
00152 int searchId(int id, vector<Pose3D> *ris, vector<MIPMatrix> *measCov, Decimal *rightProb, vector<Decimal> *weights);
00153
00155 string printSolutions(vector<Pose3D> *ris);
00156
00158 string print(int opt = 0);
00159
00161 string getObjectName() const{
00162 return "ProbMultiRegCam3DQuadSol";
00163 }
00164
00165 };
00166
00170 class ProbMultiRegCam3DCam : public MIPObject {
00171 private:
00172
00173 map <int, vector<Pose3D> > *likelihood;
00174
00175 vector <int> activeLikelihoods;
00176
00177 public:
00179 ProbMultiRegCam3DQuadPar _par;
00180
00182 ProbMultiRegCam3DCam(ProbMultiRegCam3DQuadPar par);
00183
00185 ~ProbMultiRegCam3DCam();
00186
00188 void initExample(vector<AngleBearId> &input);
00189
00191 void print(vector<AngleBearId> input, int option);
00192
00194 void print(vector< vector<Decimal> > input);
00195
00197 void initTriangles(vector<AngleBearId> &input, ProbMultiRegCam3DQuadSol *mrcsols, int myId);
00198
00200 vector <vector<Angle> > createAng(vector<vector<Angle> > input);
00201
00203 void evalTria(vector<AngleBearId> &input,int firstV,int firstF,int firstS,int secondV,int secondF,int secondS,int thirdV,int thirdF,int thirdS,Triangle *triaPointer);
00204
00205
00206
00208 int step(int argc, char** argv);
00209
00211 void eraseDup(Triangle* &triaPointer, Decimal thr);
00212
00214 void eraseDup3(Triangle* &triaPointer, Decimal thr);
00215
00217 void eraseDup2(Triangle* &triaPointer, Decimal thr);
00218
00220 bool eraseDupTria(vector<Triangle*> &trias, Triangle* &tria);
00221
00223 void createPol(vector<Triangle*> triaSols, int myId,ProbMultiRegCam3DQuadSol *mrcsols);
00224
00226 void quickSortTria(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00227
00229 void selectSubSol(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00230
00232 void printDataIn(AngleBearId* first,int f1,int f2, AngleBearId* second, int s1, int s2, AngleBearId* third, int t1, int t2,int info1,int info2, int info3, int id1, int id2, int id3);
00233
00235 void setLikelihood(vector<int>& ids, map <int, vector<Pose3D> >* lik);
00236
00238 string getObjectName() const {
00239 return "ProbMultiRegCam3DCam";
00240 }
00241
00242
00243 fstream _logProbMultiRegCam3DCamFile;
00244 fstream _logProbMultiRegCam3DCamOutput;
00246
00247
00248
00249 };
00250
00251 }
00252
00253 #endif