Homography.h

Go to the documentation of this file.
00001 /*
00002 * Copyright (C) 2007-2008 Anael Orlinski
00003 *
00004 * This file is part of Panomatic.
00005 *
00006 * Panomatic is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * Panomatic is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU General Public License
00017 * along with Panomatic; if not, write to the Free Software
00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00020 
00021 #ifndef __lsurf_homography_h
00022 #define __lsurf_homography_h
00023 
00024 #include <iostream>
00025 using namespace std;
00026 
00027 #include "PointMatch.h"
00028 #include <vector>
00029 
00030 namespace lfeat
00031 {
00032 
00033 class LFIMPEX Homography
00034 {
00035 public:
00036     Homography();
00037     ~Homography();
00038 
00039     void initMatchesNormalization(PointMatchVector_t& iMatches);
00040 
00041     bool estimate(PointMatchVector_t& iMatches);
00042 
00043     friend ostream& operator<< (ostream& o, const Homography& H);
00044 
00045     void transformPoint(double iX, double iY, double& oX, double& oY);
00046 
00047 
00048 private:
00049     void initialize(void);
00050 
00051     void addMatch(int iIndex, PointMatch& iMatch);
00052 
00053     double** AA;
00054     double*      B, * X, *r;
00055 
00056     static const int kNCols;
00057 
00058 
00059     void allocMemory(int iNPoints);
00060     void freeMemory();
00061 
00062     // the matrices for solving least squares
00063     double** _Amat;
00064     double* _Bvec;
00065     double* _Rvec;
00066     double* _Xvec;
00067 
00068 public:
00069     double      _H[3][3];       // the homography matrix.
00070     int         _nMatches;      // number of matches to calc homography
00071     int         _currentPair; // the current pair to be set
00072 
00073     // values for vector normalization
00074     double _v1x, _v2x, _v1y, _v2y;
00075 
00076 
00077 };
00078 
00079 ostream& operator<< (ostream& o, const Homography& H);
00080 
00081 }
00082 
00083 #endif // __lsurf_homography_h
00084 

Generated on 31 Oct 2014 for Hugintrunk by  doxygen 1.4.7