/******************************************************************** ** Image Component Library (ICL) ** ** ** ** Copyright (C) 2006-2012 CITEC, University of Bielefeld ** ** Neuroinformatics Group ** ** Website: www.iclcv.org and ** ** http://opensource.cit-ec.de/projects/icl ** ** ** ** File : include/ICLAlgorithms/SoftPosit.h ** ** Module : ICLAlgorithms ** ** Authors: Christian Groszewski ** ** ** ** ** ** Commercial License ** ** ICL can be used commercially, please refer to our website ** ** www.iclcv.org for more details. ** ** ** ** GNU General Public License Usage ** ** Alternatively, this file may be used under the terms of the ** ** GNU General Public License version 3.0 as published by the ** ** Free Software Foundation and appearing in the file LICENSE.GPL ** ** included in the packaging of this file. Please review the ** ** following information to ensure the GNU General Public License ** ** version 3.0 requirements will be met: ** ** http://www.gnu.org/copyleft/gpl.html. ** ** ** ** The development of this software was supported by the ** ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** ** Forschungsgemeinschaft (DFG) in the context of the German ** ** Excellence Initiative. ** ** ** *********************************************************************/ #ifndef ICL_SOFTPOSIT_H_ #define ICL_SOFTPOSIT_H_ #include #include #include #include #include #include #ifdef HAVE_QT #include #endif namespace icl{ class SoftPosit{ private: //M unsigned int nbWorldPts; //N unsigned int nbImagePts; DynMatrix centeredImage; DynMatrix distMat; DynMatrix assignMat; double gamma; double beta; double betaFinal; static const double betaUpdate = 1.05; static const double betaZero = 0.0004; #ifdef HAVE_QT ICLDrawWidget *dw; #endif DynMatrix iAdj; DynMatrix wAdj; //expected or random pose //DynMatrix Q1; //expected or random pose //DynMatrix Q2; //squared distances DynMatrix d; DynMatrix w; //object points std::vector > P; //image points std::vector > p; DynMatrix L; DynMatrix invL; DynMatrix U; DynMatrix s; DynMatrix V; DynMatrix svdResult; DynMatrix eye2_2; DynMatrix r1T; DynMatrix r2T; DynMatrix r3T; DynMatrix projectedU; DynMatrix projectedV; DynMatrix replicatedProjectedU; DynMatrix replicatedProjectedV; DynMatrix col1; DynMatrix wkxj; DynMatrix col2; DynMatrix wkyj; DynMatrix pts2d; DynMatrix summedByColAssign; DynMatrix weightedUi; DynMatrix weightedVi; DynMatrix R1; DynMatrix R2; DynMatrix R3; DynMatrix ROT; DynMatrix T; double Tz; double Tx; double Ty; double f; double sumNonslack; double sum; double alpha; bool draw; DynMatrix& cross(DynMatrix &x, DynMatrix &y, DynMatrix &r); void maxPosRatio(DynMatrix &assignMat, DynMatrix &pos, DynMatrix &ratios); DynMatrix &sinkhornImp(DynMatrix &M); double cond(DynMatrix &A); double max(DynMatrix s); public: SoftPosit(); ~SoftPosit(); void init(); DynMatrix getRotationMat(){ return ROT; } DynMatrix getTranslation(){ return T; } //unused int numMatches(DynMatrix &assignMat); void softPosit(DynMatrix imagePts, DynMatrix worldPts, double beta0, int noiseStd, DynMatrix initRot, DynMatrix initTrans, double focalLength, DynMatrix center = DynMatrix(2,0), bool draw = true); #ifdef HAVE_QT void softPosit(DynMatrix imagePts, DynMatrix imageAdj, DynMatrix worldPts, DynMatrix worldAdj, double beta0, int noiseStd, DynMatrix initRot, DynMatrix initTrans, double focalLength, ICLDrawWidget &w, DynMatrix center = DynMatrix(2,0), bool draw = true); #endif void softPosit(std::vector imagePts, std::vector > worldPts, double beta0, int noiseStd, DynMatrix initRot, DynMatrix initTrans, double focalLength, DynMatrix center = DynMatrix(2,0)); #ifdef HAVE_QT void softPosit(std::vector imagePts, DynMatrix imageAdj, std::vector > worldPts, DynMatrix worldAdj, double beta0, int noiseStd, DynMatrix initRot, DynMatrix initTrans, double focalLength, ICLDrawWidget &w, DynMatrix center = DynMatrix(2,0), bool draw=true); #endif void proj3dto2d(DynMatrix pts3d, DynMatrix &rot, DynMatrix &trans, double flength, int objdim, DynMatrix ¢er, DynMatrix &pts2d); bool isNullMatrix(const DynMatrix &M){ bool isNull = true; for(unsigned int i=0;i & imagePts, const DynMatrix &projWorldPts, unsigned int delay=200); void visualize(ICLDrawWidget &w,const DynMatrix & imagePts, const DynMatrix &imageAdj, const DynMatrix &projWorldPts, const DynMatrix &worldAdj, unsigned int delay=200); #endif }; } #endif /* ICL_SOFTPOSIT_H_ */