00001 /* ======================================================================== 00002 * PROJECT: ARToolKitPlus 00003 * ======================================================================== 00004 * 00005 * The robust pose estimator algorithm has been provided by G. Schweighofer 00006 * and A. Pinz (Inst.of El.Measurement and Measurement Signal Processing, 00007 * Graz University of Technology). Details about the algorithm are given in 00008 * a Technical Report: TR-EMT-2005-01, available at: 00009 * http://www.emt.tu-graz.ac.at/publications/index.htm 00010 * 00011 * Ported from MATLAB to C by T.Pintaric (Vienna University of Technology). 00012 * 00013 * Copyright of the derived and new portions of this work 00014 * (C) 2006 Graz University of Technology 00015 * 00016 * This framework is free software; you can redistribute it and/or modify 00017 * it under the terms of the GNU General Public License as published by 00018 * the Free Software Foundation; either version 2 of the License, or 00019 * (at your option) any later version. 00020 * 00021 * This framework is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU General Public License 00027 * along with this framework; if not, write to the Free Software 00028 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00029 * 00030 * For further information please contact 00031 * Dieter Schmalstieg 00032 * <schmalstieg@icg.tu-graz.ac.at> 00033 * Graz University of Technology, 00034 * Institut for Computer Graphics and Vision, 00035 * Inffeldgasse 16a, 8010 Graz, Austria. 00036 * ======================================================================== 00037 ** @author Thomas Pintaric 00038 * 00039 * $Id: librpp.h 162 2006-04-19 21:28:10Z grabner $ 00040 * @file 00041 * ======================================================================== */ 00042 00043 #if defined(_MSC_VER) || defined(_WIN32_WCE) 00044 00045 #ifdef LIBRPP_STATIC 00046 # define LIBRPP_API 00047 #elif LIBRPP_DLL 00048 # ifdef LIBRPP_EXPORTS 00049 # define LIBRPP_API __declspec(dllexport) 00050 # else 00051 # define LIBRPP_API __declspec(dllimport) 00052 # endif 00053 #else 00054 # pragma error ("please define either LIBRPP_STATIC or LIBRPP_DLL") 00055 #endif 00056 00057 #else 00058 // for linux 00059 #define LIBRPP_API 00060 00061 #endif 00062 00063 typedef double rpp_float; 00064 typedef double rpp_vec[3]; 00065 typedef double rpp_mat[3][3]; 00066 00067 LIBRPP_API void robustPlanarPose(rpp_float &err, 00068 rpp_mat &R, 00069 rpp_vec &t, 00070 const rpp_float cc[2], 00071 const rpp_float fc[2], 00072 const rpp_vec *model, 00073 const rpp_vec *iprts, 00074 const unsigned int model_iprts_size, 00075 const rpp_mat R_init, 00076 const bool estimate_R_init, 00077 const rpp_float epsilon, 00078 const rpp_float tolerance, 00079 const unsigned int max_iterations); 00080 /* 00081 00082 [OUTPUT] 00083 00084 err: squared reprojection error 00085 R: rotation matrix (iprts[n] = R*model[n]+t) 00086 t: translation vector (iprts[n] = R*model[n]+t) 00087 00088 [INPUT] 00089 00090 cc: camera's principal point [x,y] 00091 fc: camera's focal length [x,y] 00092 model: 3d points [x,y,z] 00093 iprts: 2d projections [x,y,1] 00094 00095 model_iprts_size: number of 2d/3d point correspondences 00096 R_init: initial estimate of the rotation matrix R 00097 estimate_R_init: when true, the estimate in R_init is ignored 00098 epsilon*: see below (default: 1E-8) 00099 tolerance*: see below (default: 1E-5) 00100 max_iterations*: max. number of iterations (0 = infinite) 00101 00102 *) the following code fragment illustrates the use of epsilon, 00103 tolerance and max_iterations: 00104 00105 while((ABS(( old_err - new_err ) / old_err) > tolerance) && 00106 ( new_err > epsilon ) && 00107 ( max_iterations == 0 || iterations < max_iterations )) 00108 { 00109 NEW ITERATION 00110 } 00111 00112 */