FernPoseEstimator.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
3  *
4  * Copyright 2007-2012 VTT Technical Research Centre of Finland
5  *
6  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
7  * <http://www.vtt.fi/multimedia/alvar.html>
8  *
9  * ALVAR is free software; you can redistribute it and/or modify it under the
10  * terms of the GNU Lesser General Public License as published by the Free
11  * Software Foundation; either version 2.1 of the License, or (at your option)
12  * any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with ALVAR; if not, see
21  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
22  */
23 
24 #include "FernPoseEstimator.h"
25 
26 namespace alvar {
27 
29  : mPose()
30  , mCamera()
31  , mCameraEC()
32 {
33 }
34 
36 {
37 }
38 
40 {
41  return mPose;
42 }
43 
45 {
46  return mCamera;
47 }
48 
49 bool FernPoseEstimator::setCalibration(const std::string &filename, int width, int height)
50 {
51  bool r1 = mCamera.SetCalib(filename.c_str(), width, height);
52  bool r2 = mCameraEC.SetCalib(filename.c_str(), width, height);
53  return r1 && r2;
54 }
55 
57 {
58  mCamera.SetRes(width, height);
59  mCameraEC.SetRes(width, height);
60 }
61 
63 {
64  mCamera.CalcExteriorOrientation(mpts, ipts, &mPose); // TODO replace camera->cameraec
65 }
66 
68 {
69  mCameraEC.UpdatePose(container, &mPose);
70 }
71 
73 {
74  ExternalContainerMap::iterator iter = container.begin();
75  ExternalContainerMap::iterator iter_end = container.end();
76  for(; iter != iter_end; ++iter) {
77  alvar::ExternalContainer &f = iter->second;
79  f.has_p3d = true;
80  }
81 }
82 
83 } // namespace alvar
Main ALVAR namespace.
Definition: Alvar.h:174
std::vector< CvPoint2D64f > ImagePointVector
f
bool UpdatePose(std::map< int, T > &container, Pose *pose, int type_id=-1, std::map< int, double > *weights=0)
Update the pose using the items with matching type_id.
Definition: EC.h:473
void Get3dOnPlane(const Pose *pose, CvPoint2D32f p2d, CvPoint3D32f &p3d)
Get 3D-coordinate for 2D feature on the plane defined by the pose (z == 0)
Definition: EC.cpp:215
void SetRes(int _x_res, int _y_res)
If we have no calibration file we can still adjust the default calibration to current resolution...
Definition: Camera.cpp:374
int height
Definition: GlutViewer.cpp:160
This file implements a pose estimator for the Fern-based image detector.
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camer...
Definition: Camera.h:82
bool SetCalib(const char *calibfile, int _x_res, int _y_res, FILE_FORMAT format=FILE_FORMAT_DEFAULT)
Set the calibration file and the current resolution for which the calibration is adjusted to...
Definition: Camera.cpp:270
void setResolution(int width, int height)
void updateFromTrackedPoints(ExternalContainerMap &container)
CvPoint2D32f p2d
Definition: EC.h:157
bool setCalibration(const std::string &filename, int width, int height)
Pose representation derived from the Rotation class
Definition: Pose.h:50
int width
Definition: GlutViewer.cpp:159
void CalcExteriorOrientation(std::vector< CvPoint3D64f > &pw, std::vector< CvPoint2D64f > &pi, Pose *pose)
Calculate exterior orientation.
CvPoint3D32f p3d
Definition: EC.h:158
Basic structure to be usable with EC methods.
Definition: EC.h:152
std::vector< CvPoint3D64f > ModelPointVector
void extractPlaneCoordinates(ExternalContainerMap &container)
std::map< int, alvar::ExternalContainer > ExternalContainerMap
void calculateFromPointCorrespondences(ModelPointVector &mpts, ImagePointVector &ipts)


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Thu Jun 6 2019 19:27:23