Go to the documentation of this file.00001
00002 #ifndef vpgl_affine_camera_h_
00003 #define vpgl_affine_camera_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <vnl/vnl_fwd.h>
00020 #include <vgl/vgl_fwd.h>
00021 #include "vpgl_proj_camera.h"
00022
00023 template <class T>
00024 class vpgl_affine_camera : public vpgl_proj_camera<T>
00025 {
00026 public:
00027
00028
00029 vpgl_affine_camera();
00030
00031
00032 vpgl_affine_camera( const vnl_vector_fixed<T,4>& row1,
00033 const vnl_vector_fixed<T,4>& row2 );
00034
00035
00036
00037 vpgl_affine_camera( const vnl_matrix_fixed<T,3,4>& camera_matrix );
00038
00039
00040
00041 vpgl_affine_camera(vgl_vector_3d<T> ray, vgl_vector_3d<T> up,
00042 vgl_point_3d<T> stare_pt, T u0, T v0, T su, T sv);
00043
00044
00045
00046 vpgl_affine_camera(vnl_vector_fixed<T, 3> ray, vnl_vector_fixed<T, 3> up,
00047 vnl_vector_fixed<T, 3> stare_pt, T u0, T v0, T su, T sv) {
00048 vgl_vector_3d<T> ry(ray[0], ray[1], ray[2]), u(up[0], up[1], up[2]);
00049 vgl_point_3d<T> pt(stare_pt[0], stare_pt[1], stare_pt[2]);
00050 (*this) = vpgl_affine_camera<T>(ry, u, pt, u0, v0, su, sv);
00051 }
00052
00053 virtual vcl_string type_name() const { return "vpgl_affine_camera"; }
00054
00055
00056 void set_rows( const vnl_vector_fixed<T,4>& row1,
00057 const vnl_vector_fixed<T,4>& row2 );
00058
00059
00060
00061
00062 void set_viewing_distance(T dist) {view_distance_ = dist;}
00063 T viewing_distance() const {return view_distance_;}
00064
00065
00066 inline bool operator==(vpgl_affine_camera<T> const &that) const
00067 { return this == &that ||
00068 (this->get_matrix()==that.get_matrix() &&
00069 this->viewing_distance() == that.viewing_distance() );
00070 }
00071
00072
00073 virtual vgl_homg_point_3d<T> camera_center() const;
00074
00075
00076
00077 virtual vgl_homg_line_3d_2_points<T> backproject( const vgl_homg_point_2d<T>& image_point ) const;
00078
00079
00080 virtual vgl_homg_plane_3d<T> principal_plane() const;
00081
00082 private:
00083 T view_distance_;
00084 vgl_vector_3d<T> ray_dir_;
00085 };
00086
00087 #endif // vpgl_affine_camera_h_