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
00026
00030 #ifndef __PROB_MULTI_REG_CAM_H_
00031 #define __PROB_MULTI_REG_CAM_H_
00032
00033 #define BLACK "\e[2;30m"
00034 #define RED "\e[0;31m"
00035 #define GREEN "\e[0;32m"
00036 #define YELLOW "\e[0;33m"
00037 #define BLUE "\e[0;34m"
00038 #define MAGENTA "\e[0;35m"
00039 #define CYAN "\e[0;36m"
00040 #define WHITE "\e[0;37m"
00041 #define STOPCOLOR "\e[m"
00042
00043 #include <MIPMatrix.h>
00044 #include "time.h"
00045 #include <fstream>
00046 #include <stdlib.h>
00047 #include <stdio.h>
00048 #include <vector>
00049 #include <iostream>
00050 #include <R2.h>
00051 #include <S1.h>
00052 #include <SE2.h>
00053 #include <map>
00054 #include "ProbMultiRegCamStr.h"
00055
00056
00057 using namespace std;
00058 using namespace MipBaselib;
00059
00060 namespace MipAlgorithms{
00061
00062 class ProbMultiRegCamPar {
00063 private:
00064 Decimal _linearTollerance;
00065 Decimal _angularTollerance;
00066 Decimal _projTollerance;
00067 int _expandMethod;
00068
00069 public:
00071 ProbMultiRegCamPar();
00072
00074 ProbMultiRegCamPar(Decimal lt, Decimal at, Decimal pt,int expandMethod);
00075
00077 ProbMultiRegCamPar(const ProbMultiRegCamPar &A);
00078
00080 ProbMultiRegCamPar& operator=(ProbMultiRegCamPar &A);
00081
00083
00084 Decimal getLinearTollerance();
00085
00087
00088 Decimal getAngularTollerance();
00089
00091 Decimal getProjTollerance();
00092
00094 int getExpandMethod();
00095 };
00096
00097 class ProbMultiRegCamSol {
00098 private:
00100 vector<ProbPolFusion*> _sols;
00101
00102 public:
00104
00105 ProbMultiRegCamSol();
00106
00108
00109 ProbMultiRegCamSol(ProbPolFusion *polFusion);
00110
00111 ~ProbMultiRegCamSol();
00112
00114
00115 void insertPol(ProbPolFusion *polFusion);
00116
00118
00119 int getSize();
00120
00122
00123 ProbPolFusion* getProbPolFusion(int pos);
00124
00125 vector<ProbPolFusion*> getActualSol();
00126
00127 ProbMultiRegCamSol& operator=(ProbMultiRegCamSol &A);
00128
00129 int searchId(int id, vector<Pose> *ris, vector<MIPMatrix> *measCov, Decimal *rightProb, vector<Decimal> *weights);
00130
00131 string printSolutions(vector<Pose> *ris);
00132
00134
00135 string print(int opt = 0);
00136
00137 };
00138
00139 class ProbMultiRegCam {
00140 private:
00141 map <int, vector<Pose> > *likelihood;
00142 vector <int> activeLikelihoods;
00143
00144 public:
00145 ProbMultiRegCamPar _par;
00146
00148 ProbMultiRegCam(ProbMultiRegCamPar par);
00149
00151 ~ProbMultiRegCam();
00152
00154 void initExample(vector<AngleId> &input);
00155
00157 void print(vector<AngleId> input, int option);
00158
00160 void print(vector< vector<Decimal> > input);
00161
00163 void initTriangles(vector<AngleId> &input, ProbMultiRegCamSol *mrcsols, int myId, Pose &myPose);
00164
00165
00166 vector <vector<Angle> > createAng(vector<vector<Angle> > input);
00167
00168 vector <vector<Decimal> > findFormTot(vector<vector<Angle> > input);
00169
00171 void evalTria(vector<AngleId> input,int firstV,int firstF,int firstS,int secondV,int secondF,int secondS,int thirdV,int thirdF,int thirdS,Decimal aSide,Decimal bSide,Decimal cSide,Triangle *triaPointer);
00172
00173
00174
00176 int step(int argc, char** argv);
00177
00178
00179
00181 void eraseDup(Triangle* &triaPointer, Decimal thr);
00182
00184 void eraseDup3(Triangle* &triaPointer, Decimal thr);
00185
00186 bool eraseDupTria(vector<Triangle*> &trias, Triangle* &tria);
00187
00189 void createPol(vector<Triangle*> triaSols, int myId,ProbMultiRegCamSol *mrcsols,Pose &myPose);
00190
00192 void quickSortTria(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00193
00195 void selectSubSol(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00196
00198 void printDataIn(AngleId* first,int f1,int f2, AngleId* second, int s1, int s2, AngleId* third, int t1, int t2,int info1,int info2, int info3, int id1, int id2, int id3);
00199
00201 void setLikelihood(vector<int>& ids, map <int, vector<Pose> >* lik);
00202
00203 fstream _logProbMultiRegCamFile;
00204 fstream _logProbMultiRegCamOutput;
00206
00207
00208
00209
00210 };
00211
00212
00213
00214 }
00215
00216 #endif
00217
00218
00219
00220
00221
00222
00223
00225
00226
00227
00228
00229
00231
00232
00233
00234
00235
00236
00238
00239
00240
00241
00242
00244
00245
00246
00247
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00278
00279
00280
00282
00283
00284
00285
00287
00288
00289
00290
00291
00292
00293
00294
00295
00297
00298
00299
00300
00302
00303
00304
00305
00306
00307
00308
00309
00310
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322