Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "FernPoseEstimator.h"
00025
00026 namespace alvar {
00027
00028 FernPoseEstimator::FernPoseEstimator()
00029 : mPose()
00030 , mCamera()
00031 , mCameraEC()
00032 {
00033 }
00034
00035 FernPoseEstimator::~FernPoseEstimator()
00036 {
00037 }
00038
00039 Pose FernPoseEstimator::pose() const
00040 {
00041 return mPose;
00042 }
00043
00044 Camera FernPoseEstimator::camera() const
00045 {
00046 return mCamera;
00047 }
00048
00049 bool FernPoseEstimator::setCalibration(const std::string &filename, int width, int height)
00050 {
00051 bool r1 = mCamera.SetCalib(filename.c_str(), width, height);
00052 bool r2 = mCameraEC.SetCalib(filename.c_str(), width, height);
00053 return r1 && r2;
00054 }
00055
00056 void FernPoseEstimator::setResolution(int width, int height)
00057 {
00058 mCamera.SetRes(width, height);
00059 mCameraEC.SetRes(width, height);
00060 }
00061
00062 void FernPoseEstimator::calculateFromPointCorrespondences(FernPoseEstimator::ModelPointVector &mpts, FernPoseEstimator::ImagePointVector &ipts)
00063 {
00064 mCamera.CalcExteriorOrientation(mpts, ipts, &mPose);
00065 }
00066
00067 void FernPoseEstimator::updateFromTrackedPoints(FernPoseEstimator::ExternalContainerMap &container)
00068 {
00069 mCameraEC.UpdatePose(container, &mPose);
00070 }
00071
00072 void FernPoseEstimator::extractPlaneCoordinates(FernPoseEstimator::ExternalContainerMap &container)
00073 {
00074 ExternalContainerMap::iterator iter = container.begin();
00075 ExternalContainerMap::iterator iter_end = container.end();
00076 for(; iter != iter_end; ++iter) {
00077 alvar::ExternalContainer &f = iter->second;
00078 mCameraEC.Get3dOnPlane(&mPose, f.p2d, f.p3d);
00079 f.has_p3d = true;
00080 }
00081 }
00082
00083 }