My Project
TrifocalTensor.h
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 #ifndef __TRIFOCAL_TENSOR__
25 #define __TRIFOCAL_TENSOR__
26 
27 #include "Alvar.h"
28 #include "Pose.h"
29 
30 #include <opencv2/core.hpp>
31 
38 namespace alvar {
39 
71 class ALVAR_EXPORT TrifocalTensor
72 {
73 private:
74  double T[3][3][3];
75  double projectAxis(const cv::Point2d &p0, const cv::Point2d &p1, int l);
76 
77 public:
79 
86  TrifocalTensor(const Pose &P1, const Pose &P2);
87 
95  TrifocalTensor(const Pose &P0, const Pose &P1, const Pose &P2);
96 
97  ~TrifocalTensor();
98 
109  void computeTensor(const Pose &P1, const Pose &P2);
110 
117  void computeTensor(const Pose &P0, const Pose &P1, const Pose &P2);
118 
130  void project(const cv::Point2d &p0, const cv::Point2d &p1, cv::Point2d &p2);
131 
148  double projectError(const cv::Point2d &p0, const cv::Point2d &p1, const cv::Point2d &p2);
149 };
150 
151 } // namespace alvar
152 
153 #endif // __TRIFOCAL_TENSOR__
This file defines library export definitions, version numbers and build information.
This file implements a pose.
Pose representation derived from the Rotation class
Definition: Pose.h:53
Trifocal tensor works for three images like a fundamental matrix works for two images.
void computeTensor(const Pose &P1, const Pose &P2)
Initializes the tensor from identity pose and two other known poses.
void project(const cv::Point2d &p0, const cv::Point2d &p1, cv::Point2d &p2)
Computes the projection of a point in the third pose.
TrifocalTensor(const Pose &P0, const Pose &P1, const Pose &P2)
Constructs a tensor from three known poses. See computeTensor.
TrifocalTensor(const Pose &P1, const Pose &P2)
Constructs a tensor from identity pose and two other known poses. See computeTensor.
void computeTensor(const Pose &P0, const Pose &P1, const Pose &P2)
Initializes the tensor from three known poses.
double projectError(const cv::Point2d &p0, const cv::Point2d &p1, const cv::Point2d &p2)
Computes how much three points differ from the tensor.
Main ALVAR namespace.
Definition: Alvar.h:174