![]() |
University of Murcia, Spain ![]() |
src/qvmath/qvprojective.h00001 /* 00002 * Copyright (C) 2007, 2008, 2009. PARP Research Group. 00003 * <http://perception.inf.um.es> 00004 * University of Murcia, Spain. 00005 * 00006 * This file is part of the QVision library. 00007 * 00008 * QVision is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as 00010 * published by the Free Software Foundation, version 3 of the License. 00011 * 00012 * QVision is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with QVision. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef PROJECTIVE_H 00022 #define PROJECTIVE_H 00023 00024 #include <QPair> 00025 #include <qvmath.h> 00026 #include <QVMatrix> 00027 00031 00034 00035 void homogenizePoints(const QList< QPair<QPointF, QPointF> > &matchings, 00036 QVMatrix &premult, QVMatrix &postmult, 00037 QList< QPair<QPointF, QPointF> > &homogeneizedPairs); 00038 00039 /* 00040 @brief Obtains an homography from two lists of corresponding points. 00041 @ingroup qvprojectivegeometry 00042 00043 This function returns the homography that maps the points from a source position to a 00044 destination position, according to a projective transormation. 00045 00046 @deprecated Use @ref ComputeProjectiveHomography instead 00047 @param sourcePoints list of source points. 00048 @param destinationPoints list of destination points. 00049 */ 00050 //QVMatrix ComputeHomography(const QList<QPointF> &sourcePoints, const QList<QPointF> &destPoints); 00051 00119 QVMatrix ComputeProjectiveHomography(const QList< QPair<QPointF, QPointF> > &matchings); 00120 00121 /* 00122 @brief Obtains the fundamental matrix between two images, using the 8 point algorithm. 00123 @ingroup qvprojectivegeometry 00124 00125 This function performs point normalization to robustly obtain the F matrix. 00126 00127 @param matchings list of 8 point matchings 00128 */ 00129 //QVMatrix ComputeFundamentalMatrix(const QList< QPair<QPointF, QPointF> > &matchings); 00130 00138 QVMatrix ComputeEuclideanHomography(const QList< QPair<QPointF, QPointF> > &matchings); 00139 00154 QPointF ApplyHomography(const QVMatrix &homography, const QPointF &point); 00155 00168 QList<QPointF> ApplyHomography(const QVMatrix &homography, const QList<QPointF> &sourcePoints); 00169 00191 double HomographyTestError(const QVMatrix &homography); 00192 00198 void GetExtrinsicCameraMatrixFromHomography(const QVMatrix &K, const QVMatrix &H, QVMatrix &M4x4); 00199 00213 void GetDirectIntrinsicCameraMatrixFromHomography(const QVMatrix &H, QVMatrix &K); 00214 00227 //void GetIntrinsicCameraMatrixFromHomography(const QVMatrix &H, QVMatrix &K, 00228 // double focal = 3, const double maxFocal = 50, const int maxIterations = 100, const double maxError = 0.00001); 00229 00234 void CalibrateCameraFromPlanarHomography(const QVMatrix &H, QVMatrix &K, QVMatrix &Rt); 00235 00280 void GetPinholeCameraIntrinsicsFromPlanarHomography( const QVMatrix &H, QVMatrix &K, const int iterations = 100, 00281 const double maxGradientNorm = 1e-3, const double step = 0.01, const double tol = 1e-4); 00282 #endif |