00001 /* 00002 * This file is part of ALVAR, A Library for Virtual and Augmented Reality. 00003 * 00004 * Copyright 2007-2012 VTT Technical Research Centre of Finland 00005 * 00006 * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi> 00007 * <http://www.vtt.fi/multimedia/alvar.html> 00008 * 00009 * ALVAR is free software; you can redistribute it and/or modify it under the 00010 * terms of the GNU Lesser General Public License as published by the Free 00011 * Software Foundation; either version 2.1 of the License, or (at your option) 00012 * any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, but WITHOUT 00015 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00016 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00017 * for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public License 00020 * along with ALVAR; if not, see 00021 * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>. 00022 */ 00023 00024 #ifndef FERNPOSEESTIMATOR_H 00025 #define FERNPOSEESTIMATOR_H 00026 00034 #include <map> 00035 #include <vector> 00036 00037 #include "cv.h" 00038 00039 #include "Pose.h" 00040 #include "Camera.h" 00041 #include "EC.h" 00042 00043 namespace alvar 00044 { 00045 00049 class ALVAR_EXPORT FernPoseEstimator 00050 { 00051 00052 public: 00053 FernPoseEstimator(); 00054 ~FernPoseEstimator(); 00055 00056 Pose pose() const; 00057 Camera camera() const; 00058 00059 bool setCalibration(const std::string &filename, int width, int height); 00060 void setResolution(int width, int height); 00061 00062 typedef std::vector<CvPoint2D64f> ImagePointVector; 00063 typedef std::vector<CvPoint3D64f> ModelPointVector; 00064 typedef std::map<int, alvar::ExternalContainer> ExternalContainerMap; 00065 void calculateFromPointCorrespondences(ModelPointVector &mpts, ImagePointVector &ipts); 00066 void updateFromTrackedPoints(ExternalContainerMap &container); 00067 void extractPlaneCoordinates(ExternalContainerMap &container); 00068 00069 private: 00070 Pose mPose; 00071 Camera mCamera; 00072 CameraEC mCameraEC; 00073 }; 00074 00075 } // namespace alvar 00076 00077 #endif