25 #ifndef __BIAS_CamPoseCalib_HH
26 #define __BIAS_CamPoseCalib_HH
28 #include <bias_config.h>
29 #include <Base/Common/W32Compat.hh>
37 #include <Base/Debug/Debug.hh>
38 #include <Base/Math/Vector3.hh>
39 #include <Base/Math/Matrix.hh>
40 #include <Base/Math/Matrix2x2.hh>
41 #include <Geometry/RMatrix.hh>
42 #include <Geometry/PMatrix.hh>
46 #define D_BIAS_CAMPOSE_ESTIMATE_STEPS 1<<0
47 #define D_BIAS_CAMPOSE_ESTIMATE_EQSYS 1<<1
48 #define D_BIAS_CAMPOSE_INIT 1<<2
49 #define D_BIAS_CAMPOSE_APPLY_SOL 1<<3
50 #define D_BIAS_CAMPOSE_ESTIMATE_ITER 1<<4
51 #define D_BIAS_CAMPOSE_EQSYS 1<<5
52 #define D_BIAS_CAMPOSE_LM 1<<6
53 #define D_BIAS_CAMPOSE_INITGUESS 1<<7
54 #define D_BIAS_CAMPOSE_SECD 1<<8
115 int SetInitialCamera(
double fx,
double fy,
double cx,
double cy);
122 int SetInitialCamera(
double fx,
double fy,
double cx,
double cy,
130 inline void SetLM(
bool on){ doLM_=on; }
144 const bool estimateTransY,
145 const bool estimateTransZ) {
146 estimateTransX_=estimateTransX; estimateTransY_=estimateTransY;
147 estimateTransZ_=estimateTransZ;
154 transChangeEpsilon_ = transEpsilon;
155 rotChangeEpsilon_ = rotEpsilon;
161 { weights_=weights; }
164 { weightsLine_=weights; }
172 { outlierError_=k; robustFunc_=func; }
180 { variances_= variances; }
192 int Estimate(
unsigned int iterations=20);
208 {
return camR_* resultR_.Transpose() *
209 ((-1.0/scaleNumStabiltity_)*resultTrans_); }
235 double GetAvgError();
243 truthUpVec_= upVector;
245 truthOptAxis_=optAxis;
270 double GetAvgSquaredWeightedError_();
275 int CreateEquationSys_();
278 int AddConstraints2DLine_();
286 int SetWeightsByError_();
289 int CreateSecDMatrix_();
291 int GuessInitialCam_();
293 int ApplyCoVariances_();
296 void outputPose_(
int iteration);
299 std::vector<BIAS::Vector3<double> > mps_,initialMps_,
origMps_;
300 std::vector<BIAS::Vector2<double> >
tps_;
303 std::vector<BIAS::Vector3<double> > mpsLine_,
origMpsLine_,initialMpsLine_;
void SetGroundTruth(BIAS::Vector3< double > optAxis, BIAS::Vector3< double > upVector, BIAS::Vector3< double > center)
for analyzing only.
std::vector< double > weightsLine_
double transChangeEpsilon_
std::vector< BIAS::Vector3< double > > origMps_
void SetChangeEpsilon(double transEpsilon, double rotEpsilon)
if the estimated translation in one iteration step is smaller than this value, iteration stops...
BIAS::Vector3< double > origAvgModel_
computes and holds the singular value decomposition of a rectangular (not necessarily quadratic) Matr...
BIAS::Matrix< double > coVarMat_
BIAS::Vector3< double > GetTranslation() const
this returns the translation from the initial camera center to the new camera center ...
BIAS::Vector< double > solveVector_
this classs allows estimation of the internal (except skew) and external camera parameters by an iter...
void SetWeightsLine(const std::vector< double > &weights)
void SetWeights(const std::vector< double > &weights)
optional: set weights for each correspondence.
bool doLM_
for LM algorithm extension
void SetVariances(const std::vector< BIAS::Matrix2x2< double > > &variances)
If uncertainties for the 2D points is available set them here.
BIAS::Vector3< double > truthUpVec_
std::vector< BIAS::Vector2< double > > tps_
void SetEstimatePrincipal(bool yes)
wether to estimate the principal point also, default is NO
double errorIncreaseForLM_
BIAS::Matrix< double > solveMatrix_
BIAS::RMatrix GetRotation() const
this return the relative rotation from the initial camera orientation to the new estimated camera rot...
BIAS::Vector3< double > resultTrans_
Matrix3x3< T > Transpose() const
returns transposed matrix tested 12.06.2002
double scaleNumStabiltity_
std::vector< BIAS::Vector3< double > > origMpsLine_
void SetWeighting(double k, int func=1)
optional: do robust estimation, if the error is larger than k, an outlier is assumed ...
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
void SetLM(bool on)
wether to do Levenberg-Maquardt estimation.
std::vector< BIAS::Vector2< double > > tpsLinePoint_
BIAS::Matrix< double > secDMatrix_
describes a projective 3D -> 2D mapping in homogenous coordinates
void SetEstimateTranslation(const bool estimateTransX, const bool estimateTransY, const bool estimateTransZ)
void SetEstimateFocal(unsigned char val)
wether to estimate the focal length f also, default is NO
std::vector< BIAS::Matrix2x2< double > > variances_