vpgl_camera_compute.h
Go to the documentation of this file.
1 // This is core/vpgl/algo/vpgl_camera_compute.h
2 #ifndef vpgl_camera_compute_h_
3 #define vpgl_camera_compute_h_
4 //:
5 // \file
6 // \brief Several routines for computing different kinds of cameras from world-point correspondences.
7 // \author Thomas Pollard
8 // \date July 18, 2005
9 //
10 // Should template this class.
11 
12 #include <vector>
14 #include <vpgl/vpgl_proj_camera.h>
16 #ifdef _MSC_VER
17 # include <vcl_msvc_warnings.h>
18 #endif
19 #include <vgl/vgl_fwd.h>
20 #include <vnl/vnl_fwd.h>
21 
22 //: Basic least squares solution for a general projective camera given corresponding world and image points.
24 {
25  public:
26  //: Compute from two sets of corresponding points.
27  // Put the resulting camera into \p camera
28  // \return true if successful.
29  static bool compute( const std::vector< vgl_homg_point_2d<double> >& image_pts,
30  const std::vector< vgl_homg_point_3d<double> >& world_pts,
31  vpgl_proj_camera<double>& camera );
32  //: Compute from two sets of corresponding points.
33  // Put the resulting camera into \p camera
34  // \return true if successful.
35  static bool compute( const std::vector< vgl_point_2d<double> >& image_pts,
36  const std::vector< vgl_point_3d<double> >& world_pts,
37  vpgl_proj_camera<double>& camera );
38  private:
39  //:default constructor (is private)
40  vpgl_proj_camera_compute() = delete;
41 };
42 
43 
44 //: Basic least squares solution for an affine camera given corresponding world and image points.
46 {
47  public:
48  //: Compute from two sets of corresponding points.
49  // Put the resulting camera into \p camera
50  // \return true if successful.
51  static bool compute( const std::vector< vgl_point_2d<double> >& image_pts,
52  const std::vector< vgl_point_3d<double> >& world_pts,
54  private:
55  vpgl_affine_camera_compute() = delete;
56 };
57 
58 
59 //:Various methods for computing a perspective camera
61 {
62  public:
63  //: Compute from two sets of corresponding points.
64  // Put the resulting camera into \p camera
65  // \return true if successful.
66  static bool compute( const std::vector< vgl_point_2d<double> >& image_pts,
67  const std::vector< vgl_point_3d<double> >& world_pts,
70 
71 
72  //: Uses the direct linear transform algorithm described in "Multiple
73  // View Geometry in Computer Vision" to find the projection matrix,
74  // and extracts the parameters of the camera from this projection matrix.
75  // Requires: \p image_pts and \p world_pts are correspondences.
76  // \p image_pts is the projected form, and \p world_pts is the unprojected form.
77  // There need to be at least 6 points.
78  // \returns true if successful.
79  // \p err is filled with the two-norm of the projection error vector.
80  // \p camera is filled with the perspective decomposition of the projection matrix.
81  static bool compute_dlt ( const std::vector< vgl_point_2d<double> >& image_pts,
82  const std::vector< vgl_point_3d<double> >& world_pts,
84  double &err);
85 
86  //: Compute from two sets of corresponding 2D points (image and ground plane).
87  // \param ground_pts are 2D points representing world points with Z=0
88  // The calibration matrix of \p camera is enforced
89  // This computation is simpler than the general case above and only requires 4 points
90  // Put the resulting camera into \p camera
91  // \return true if successful.
92  static bool compute( const std::vector< vgl_point_2d<double> >& image_pts,
93  const std::vector< vgl_point_2d<double> >& ground_pts,
95 
96  private:
98 };
99 
100 #endif // vpgl_camera_compute_h_
A class for the perspective camera model.
A class for the affine camera model.
Various methods for computing a perspective camera.
static bool compute(const std::vector< vgl_homg_point_2d< double > > &image_pts, const std::vector< vgl_homg_point_3d< double > > &world_pts, vpgl_proj_camera< double > &camera)
Compute from two sets of corresponding points.
static bool compute_dlt(const std::vector< vgl_point_2d< double > > &image_pts, const std::vector< vgl_point_3d< double > > &world_pts, vpgl_perspective_camera< double > &camera, double &err)
Uses the direct linear transform algorithm described in "Multiple.
vpgl_proj_camera_compute()=delete
default constructor (is private).
Basic least squares solution for an affine camera given corresponding world and image points.
Basic least squares solution for a general projective camera given corresponding world and image poin...
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
A camera model using the standard 3x4 matrix representation.
static bool compute(const std::vector< vgl_point_2d< double > > &image_pts, const std::vector< vgl_point_3d< double > > &world_pts, vpgl_affine_camera< double > &camera)
Compute from two sets of corresponding points.
static bool compute(const std::vector< vgl_point_2d< double > > &image_pts, const std::vector< vgl_point_3d< double > > &world_pts, const vpgl_calibration_matrix< double > &K, vpgl_perspective_camera< double > &camera)
Compute from two sets of corresponding points.