Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef VISO_STEREO_H
00023 #define VISO_STEREO_H
00024
00025 #include "viso.h"
00026 #include "mcqd.h"
00027 #include <TooN/TooN.h>
00028 class VisualOdometryStereo : public VisualOdometry {
00029
00030 public:
00031
00032
00033 struct parameters : public VisualOdometry::parameters {
00034 double base;
00035 int32_t ransac_iters;
00036 double inlier_threshold;
00037 bool reweighting;
00038 parameters () {
00039 base = 1.0;
00040 ransac_iters = 100;
00041 inlier_threshold = 2.0;
00042 reweighting = true;
00043 }
00044 };
00045
00046
00047 VisualOdometryStereo (parameters param);
00048
00049
00050 ~VisualOdometryStereo ();
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 bool process (uint8_t *I1,uint8_t *I2,int32_t* dims,bool replace=false);
00065
00066 using VisualOdometry::process;
00067 std::vector<Matcher::p_match> getMatches () { return p_matched1; }
00068
00069
00070 private:
00071
00072 std::vector<double> estimateMotion (std::vector<Matcher::p_match> p_matched);
00073 std::vector<double> estimateMotionLinear (std::vector<Matcher::p_match> p_matched);
00074 std::vector<double> estimateMotionMaxClique (std::vector<Matcher::p_match> p_matched);
00075 enum result { UPDATED, FAILED, CONVERGED };
00076 result updateParameters(std::vector<Matcher::p_match> &p_matched,std::vector<int32_t> &active,std::vector<double> &tr,double step_size,double eps);
00077 result updateParametersLinear(std::vector<Matcher::p_match> &p_matched,std::vector<int32_t> &active,std::vector<double> &tr,double step_size,double eps);
00078 result updateParametersP3p(std::vector<Matcher::p_match> &p_matched,std::vector<int32_t> &active,TooN::Matrix<3,4> &tr,double step_size,double eps);
00079 void computeObservations(std::vector<Matcher::p_match> &p_matched,std::vector<int32_t> &active);
00080 void computeResidualsAndJacobian(std::vector<double> &tr,std::vector<int32_t> &active);
00081 void computeResidualsAndJacobianP3p(TooN::Matrix<3,4> &tr,std::vector<int32_t> &active);
00082 std::vector<int32_t> getInlier(std::vector<Matcher::p_match> &p_matched,std::vector<double> &tr);
00083 std::vector<int32_t> getInlier(std::vector<Matcher::p_match> &p_matched,TooN::Matrix<3,4> &tr);
00084
00085 bool justice2Matches(Matcher::p_match &m1,Matcher::p_match &m2);
00086 void creatAdjMatrix(std::vector<Matcher::p_match>& p_matched,bool** &conn);
00087
00088 double *X,*Y,*Z,*XC,*YC,*ZC;
00089 double *p_residual;
00090 double rx_old,ry_old,rz_old,tx_old,ty_old,tz_old;
00091 std::vector<Matcher::p_match> p_matched1;
00092
00093 parameters param;
00094 };
00095
00096 #endif // VISO_STEREO_H
00097