~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to extern/libmv/libmv/multiview/euclidean_resection.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 2010 libmv authors.
 
2
//
 
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
4
// of this software and associated documentation files (the "Software"), to
 
5
// deal in the Software without restriction, including without limitation the
 
6
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 
7
// sell copies of the Software, and to permit persons to whom the Software is
 
8
// furnished to do so, subject to the following conditions:
 
9
//
 
10
// The above copyright notice and this permission notice shall be included in
 
11
// all copies or substantial portions of the Software.
 
12
//
 
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
18
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 
19
// IN THE SOFTWARE.
 
20
 
 
21
#ifndef LIBMV_MULTIVIEW_EUCLIDEAN_RESECTION_H_
 
22
#define LIBMV_MULTIVIEW_EUCLIDEAN_RESECTION_H_
 
23
 
 
24
#include "libmv/numeric/numeric.h"
 
25
#include "libmv/multiview/projection.h"
 
26
 
 
27
namespace libmv {
 
28
namespace euclidean_resection {
 
29
  
 
30
enum ResectionMethod {
 
31
  RESECTION_ANSAR_DANIILIDIS,
 
32
  RESECTION_EPNP,
 
33
};
 
34
 
 
35
/**
 
36
 * Computes the extrinsic parameters, R and t for a calibrated camera
 
37
 * from 4 or more 3D points and their normalized images.
 
38
 *
 
39
 * \param x_camera  Image points in normalized camera coordinates e.g. x_camera
 
40
 *                   = inv(K) * x_image.
 
41
 * \param X_world   3D points in the world coordinate system
 
42
 * \param R         Solution for the camera rotation matrix
 
43
 * \param t         Solution for the camera translation vector
 
44
 * \param method    The resection method to use.
 
45
 */
 
46
bool EuclideanResection(const Mat2X &x_camera, 
 
47
                        const Mat3X &X_world,
 
48
                        Mat3 *R, Vec3 *t,
 
49
                        ResectionMethod method = RESECTION_EPNP);
 
50
 
 
51
/**
 
52
 * Computes the extrinsic parameters, R and t for a calibrated camera
 
53
 * from 4 or more 3D points and their images.
 
54
 *
 
55
 * \param x_image   Image points in non-normalized image coordinates. The
 
56
 *                  coordates are laid out one per row. The matrix can be Nx2
 
57
 *                  or Nx3 for euclidean or homogenous 2D coordinates.
 
58
 * \param X_world   3D points in the world coordinate system
 
59
 * \param K         Intrinsic parameters camera matrix
 
60
 * \param R         Solution for the camera rotation matrix
 
61
 * \param t         Solution for the camera translation vector
 
62
 * \param method    Resection method
 
63
 */
 
64
bool EuclideanResection(const Mat &x_image, 
 
65
                        const Mat3X &X_world,
 
66
                        const Mat3 &K,
 
67
                        Mat3 *R, Vec3 *t,
 
68
                        ResectionMethod method = RESECTION_EPNP);
 
69
 
 
70
/**
 
71
 * The absolute orientation algorithm recovers the transformation between a set
 
72
 * of 3D points, X and Xp such that:
 
73
 *
 
74
 *           Xp = R*X + t
 
75
 *
 
76
 * The recovery of the absolute orientation is implemented after this article:
 
77
 * Horn, Hilden, "Closed-form solution of absolute orientation using
 
78
 * orthonormal matrices"
 
79
 */
 
80
void AbsoluteOrientation(const Mat3X &X,
 
81
                         const Mat3X &Xp,
 
82
                         Mat3 *R,
 
83
                         Vec3 *t);
 
84
 
 
85
/**
 
86
 * Computes the extrinsic parameters, R and t for a calibrated camera from 4 or
 
87
 * more 3D points and their images.
 
88
 *
 
89
 * \param x_camera Image points in normalized camera coordinates, e.g.
 
90
 *                 x_camera=inv(K)*x_image
 
91
 * \param X_world  3D points in the world coordinate system
 
92
 * \param R        Solution for the camera rotation matrix
 
93
 * \param t        Solution for the camera translation vector
 
94
 *
 
95
 * This is the algorithm described in: "Linear Pose Estimation from Points or
 
96
 * Lines", by Ansar, A. and Daniilidis, PAMI 2003. vol. 25, no. 5.
 
97
 */
 
98
void EuclideanResectionAnsarDaniilidis(const Mat2X &x_camera, 
 
99
                                       const Mat3X &X_world,
 
100
                                       Mat3 *R, Vec3 *t);
 
101
/**
 
102
 * Computes the extrinsic parameters, R and t for a calibrated camera from 4 or
 
103
 * more 3D points and their images.
 
104
 *
 
105
 * \param x_camera Image points in normalized camera coordinates,
 
106
 *                 e.g. x_camera = inv(K) * x_image
 
107
 * \param X_world 3D points in the world coordinate system
 
108
 * \param R       Solution for the camera rotation matrix
 
109
 * \param t       Solution for the camera translation vector
 
110
 *
 
111
 * This is the algorithm described in:
 
112
 * "{EP$n$P: An Accurate $O(n)$ Solution to the P$n$P Problem", by V. Lepetit
 
113
 * and F. Moreno-Noguer and P. Fua, IJCV 2009. vol. 81, no. 2
 
114
 * \note: the non-linear optimization is not implemented here.
 
115
 */
 
116
bool EuclideanResectionEPnP(const Mat2X &x_camera,
 
117
                            const Mat3X &X_world, 
 
118
                            Mat3 *R, Vec3 *t);
 
119
 
 
120
} // namespace euclidean_resection
 
121
} // namespace libmv
 
122
 
 
123
 
 
124
#endif /* LIBMV_MULTIVIEW_EUCLIDEAN_RESECTION_H_ */