Blender  V3.3
panography.h
Go to the documentation of this file.
1 // Copyright (c) 2009 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 
22 #ifndef LIBMV_MULTIVIEW_PANOGRAPHY_H
23 #define LIBMV_MULTIVIEW_PANOGRAPHY_H
24 
25 #include "libmv/base/vector.h"
26 #include "libmv/numeric/numeric.h"
27 #include "libmv/numeric/poly.h"
28 
29 namespace libmv {
30 
31 // This implements a minimal solution (2 points) for panoramic stitching:
32 //
33 // http://www.cs.ubc.ca/~mbrown/minimal/minimal.html
34 //
35 // [1] M. Brown and R. Hartley and D. Nister. Minimal Solutions for Panoramic
36 // Stitching. CVPR07.
37 //
38 // The 2-point algorithm solves for the rotation of the camera with a single
39 // focal length (4 degrees of freedom).
40 //
41 // Compute from 1 to 3 possible focal length for 2 point correspondences.
42 // Suppose that the cameras share the same optical center and focal lengths:
43 //
44 // Image 1 => H*x = x' => Image 2
45 // x (u1j) x' (u2j)
46 // a (u11) a' (u21)
47 // b (u12) b' (u22)
48 //
49 // The return values are 1 to 3 possible values for the focal lengths such
50 // that:
51 //
52 // [f 0 0]
53 // K = [0 f 0]
54 // [0 0 1]
55 //
56 void F_FromCorrespondance_2points(const Mat& x1,
57  const Mat& x2,
58  vector<double>* fs);
59 
60 // Compute the 3x3 rotation matrix that fits two 3D point clouds in the least
61 // square sense. The method is from:
62 //
63 // K. Arun,T. Huand and D. Blostein. Least-squares fitting of 2 3-D point
64 // sets. IEEE Transactions on Pattern Analysis and Machine Intelligence,
65 // 9:698-700, 1987.
66 //
67 // Given the calibration matrices K1, K2 solve for the rotation from
68 // corresponding image rays.
69 //
70 // R = min || X2 - R * x1 ||.
71 //
72 // In case of panography, which is for a camera that shares the same camera
73 // center,
74 //
75 // H = K2 * R * K1.inverse();
76 //
77 // For the full explanation, see Section 8, Solving for Rotation from [1].
78 //
79 // Parameters:
80 //
81 // x1 : Point cloud A (3D coords)
82 // x2 : Point cloud B (3D coords)
83 //
84 // [f 0 0]
85 // K1 = [0 f 0]
86 // [0 0 1]
87 //
88 // K2 (the same form as K1, but may have different f)
89 //
90 // Returns: A rotation matrix that minimizes
91 //
92 // R = arg min || X2 - R * x1 ||
93 //
94 void GetR_FixedCameraCenter(const Mat& x1,
95  const Mat& x2,
96  const double focal,
97  Mat3* R);
98 
99 } // namespace libmv
100 
101 #endif // LIBMV_MULTIVIEW_PANOGRAPHY_H
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
float[3][3] Mat3
Definition: gpu_matrix.cc:27
#define R
void F_FromCorrespondance_2points(const Mat &x1, const Mat &x2, vector< double > *fs)
Definition: panography.cc:73
Eigen::MatrixXd Mat
Definition: numeric.h:60
void GetR_FixedCameraCenter(const Mat &x1, const Mat &x2, const double focal, Mat3 *R)
Definition: panography.cc:99