00001 // This is core/vpgl/algo/vpgl_camera_homographies.h 00002 #ifndef vpgl_camera_homographies_h_ 00003 #define vpgl_camera_homographies_h_ 00004 //: 00005 // \file 00006 // \brief Various miscellaneous methods involving cameras 00007 // \author J.L. Mundy 00008 // \date January 2, 2008 00009 // 00010 // \verbatim 00011 // Modifications 00012 // <none> 00013 // \endverbatim 00014 00015 #include <vpgl/vpgl_proj_camera.h> 00016 #include <vpgl/vpgl_perspective_camera.h> 00017 #include <vgl/algo/vgl_h_matrix_2d.h> 00018 #include <vgl/vgl_plane_3d.h> 00019 00020 class vpgl_camera_homographies 00021 { 00022 public: 00023 // The following four methods compute a homography with respect to a 00024 // world plane. The homography is computed by transforming the plane 00025 // to the X-Y plane and applying the inverse transformation to the camera. 00026 // Columns 0, 1, and 3 of the transformed camera matrix are extracted 00027 // to form the homography. 00028 00029 //: create a plane projective transformation from the camera image plane to the specified plane 00030 static vgl_h_matrix_2d<double> 00031 homography_from_camera(vpgl_proj_camera<double> const& cam, 00032 vgl_plane_3d<double> const& plane); 00033 00034 //: create a plane projective transformation from the camera image plane to the specified plane 00035 static vgl_h_matrix_2d<double> 00036 homography_from_camera(vpgl_perspective_camera<double> const& cam, 00037 vgl_plane_3d<double> const& plane); 00038 00039 00040 //: create a plane projective transformation from the specified plane to the camera image plane 00041 static vgl_h_matrix_2d<double> 00042 homography_to_camera(vpgl_proj_camera<double> const& cam, 00043 vgl_plane_3d<double> const& plane); 00044 00045 //: create a plane projective transformation from the specified plane to the camera image plane 00046 static vgl_h_matrix_2d<double> 00047 homography_to_camera(vpgl_perspective_camera<double> const& cam, 00048 vgl_plane_3d<double> const& plane); 00049 00050 //: transform a camera so that its world coordinate system has the specified plane as the world X-Y plane 00051 static vpgl_perspective_camera<double> 00052 transform_camera_to_plane(vpgl_perspective_camera<double> const& cam, 00053 vgl_plane_3d<double> const& plane); 00054 00055 //: transform a camera so that its world coordinate system has the specified plane as the world X-Y plane 00056 static vpgl_proj_camera<double> 00057 transform_camera_to_plane(vpgl_proj_camera<double> const& cam, 00058 vgl_plane_3d<double> const& plane); 00059 00060 //: transform a point cloud so that its coordinate system has the specified plane as the world X-Y plane 00061 static vcl_vector<vgl_point_3d<double> > 00062 transform_points_to_plane(vgl_plane_3d<double> const& plane, 00063 vgl_point_3d<double> const& ref_point, 00064 vcl_vector<vgl_point_3d<double> > const& pts ); 00065 private: 00066 //: no public constructor - static methods only 00067 vpgl_camera_homographies() {} 00068 }; 00069 00070 #endif // vpgl_camera_homographies_h_