Go to the documentation of this file.00001
00002 #ifndef vpgl_fundamental_matrix_h_
00003 #define vpgl_fundamental_matrix_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <vnl/vnl_fwd.h>
00028 #include <vgl/vgl_fwd.h>
00029 #include <vcl_iosfwd.h>
00030
00031 #include "vpgl_proj_camera.h"
00032
00033
00034 template <class T>
00035 class vpgl_fundamental_matrix
00036 {
00037 public:
00038
00039
00040
00041 vpgl_fundamental_matrix();
00042
00043
00044
00045 vpgl_fundamental_matrix( const vpgl_proj_camera<T>& cr,
00046 const vpgl_proj_camera<T>& cl ) : cached_svd_(NULL)
00047 { set_matrix( cr, cl ); }
00048
00049
00050 vpgl_fundamental_matrix( const vnl_matrix_fixed<T,3,3>& F ) : cached_svd_(NULL)
00051 { set_matrix( F ); }
00052
00053
00054 vpgl_fundamental_matrix(const vpgl_fundamental_matrix<T>& other);
00055
00056
00057 const vpgl_fundamental_matrix<T>& operator=( const vpgl_fundamental_matrix<T>& fm );
00058
00059
00060 virtual ~vpgl_fundamental_matrix();
00061
00062
00063
00064
00065 void get_epipoles( vgl_homg_point_2d<T>& er, vgl_homg_point_2d<T>& el ) const;
00066
00067
00068 vgl_homg_line_2d<T> r_epipolar_line( const vgl_homg_point_2d<T>& pl ) const;
00069 vgl_homg_line_2d<T> l_epipolar_line( const vgl_homg_point_2d<T>& pr ) const;
00070
00071
00072
00073 vgl_homg_line_2d<T> r_epipolar_line(const vgl_homg_line_2d<T> &epiline_l) const;
00074 vgl_homg_line_2d<T> l_epipolar_line(const vgl_homg_line_2d<T> &epiline_r) const;
00075
00076
00077
00078
00079 vpgl_proj_camera<T> extract_left_camera(
00080 const vnl_vector_fixed<T,3>& v, T lambda ) const;
00081
00082
00083
00084
00085
00086
00087 vpgl_proj_camera<T> extract_left_camera(
00088 const vcl_vector< vgl_point_3d<T> >& world_points,
00089 const vcl_vector< vgl_point_2d<T> >& image_points ) const;
00090
00091
00092
00093
00094 const vnl_matrix_fixed<T,3,3>& get_matrix() const { return F_; }
00095
00096
00097
00098 const vnl_svd<T>& svd() const{ return *cached_svd_; }
00099
00100 void set_matrix( const vpgl_proj_camera<T>& cr,
00101 const vpgl_proj_camera<T>& cl );
00102
00103 void set_matrix( const vnl_matrix_fixed<T,3,3>& F );
00104
00105 protected:
00106
00107 vnl_matrix_fixed<T,3,3> F_;
00108
00109
00110 mutable vnl_svd<T>* cached_svd_;
00111 };
00112
00113
00114 template <class T>
00115 vcl_ostream& operator<<(vcl_ostream& s, vpgl_fundamental_matrix<T> const& p);
00116
00117
00118 template <class T>
00119 vcl_istream& operator>>(vcl_istream& s, vpgl_fundamental_matrix<T>& p);
00120
00121 #endif // vpgl_fundamental_matrix_h_