2 #ifndef vpgl_proj_camera_h_ 3 #define vpgl_proj_camera_h_ 57 # include <vcl_msvc_warnings.h> 86 std::string
type_name()
const override {
return "vpgl_proj_camera"; }
104 void project(
const T x,
const T y,
const T z, T& u, T& v)
const override;
115 return this->
project( world_point ); }
122 {
return project( world_line ); }
129 {
return project( world_line ); }
166 virtual bool set_matrix(
const T* new_camera_matrix );
171 virtual void save(std::string cam_path);
233 std::vector<vnl_matrix_fixed<T,2,3> >
241 template <
class Type>
245 template <
class Type>
248 #endif // vpgl_proj_camera_h_ bool operator==(vpgl_proj_camera< T > const &that) const
Equality test.
virtual vgl_homg_plane_3d< T > principal_plane() const
Find the world plane parallel to the image plane intersecting the camera center.
void make_canonical(vpgl_proj_camera< T > &camera)
Set the camera matrix to [ I | 0 ].
vnl_matrix_fixed< T, 3, 3 > const & get_matrix() const
vnl_svd< T > * svd() const
Get a copy of the svd of the get_matrix.
~vpgl_proj_camera() override
std::vector< vnl_matrix_fixed< T, 2, 3 > > image_jacobians(const vpgl_proj_camera< T > &camera, const std::vector< vgl_point_3d< T > > &pts)
Compute the image projection Jacobians at each point.
std::istream & operator>>(std::istream &is, vpgl_local_rational_camera< T > &p)
Read from stream.
vnl_matrix_fixed< T, 3, 4 > P_
The internal representation of the get_matrix.
void project(const T x, const T y, const T z, T &u, T &v) const override
Projection from base class.
vpgl_proj_camera< T > premultiply(const vpgl_proj_camera< T > &in_camera, const vnl_matrix_fixed< T, 3, 3 > &transform)
Pre-multiply this projection matrix with a 2-d projective transform.
vgl_homg_point_2d< T > x_vanishing_point() const
Find the image coordinates of the vanishing points of the world coordinate axes.
virtual vpgl_proj_camera< T > * clone(void) const
Clone ‘this’: creation of a new object and initialization.
vgl_line_segment_2d< T > operator()(const vgl_line_segment_3d< T > &world_line) const
Standard () forward projection operator.
vgl_point_3d< T > triangulate_3d_point(const vpgl_proj_camera< T > &c1, const vgl_point_2d< T > &x1, const vpgl_proj_camera< T > &c2, const vgl_point_2d< T > &x2)
Linearly intersect two camera rays to form a 3-d point.
virtual bool set_matrix(const vnl_matrix_fixed< T, 3, 4 > &new_camera_matrix)
Setters mirror the constructors and return true if the setting was successful.
vnl_svd< T > * cached_svd_
virtual vgl_homg_line_3d_2_points< T > backproject(const vgl_homg_point_2d< T > &image_point) const
Find the 3d ray that goes through the camera center and the provided image point.
vgl_homg_point_2d< T > y_vanishing_point() const
virtual vgl_homg_point_3d< T > camera_center() const
Find the 3d coordinates of the center of the camera.
vgl_homg_point_2d< T > operator()(const vgl_homg_point_3d< T > &world_point) const
A shortcut to the above function.
vpgl_proj_camera< T > postmultiply(const vpgl_proj_camera< T > &in_camera, const vnl_matrix_fixed< T, 4, 4 > &transform)
Post-multiply this projection matrix with a 3-d projective transform.
void fix_cheirality(vpgl_proj_camera< T > &camera)
Scale the camera matrix so determinant of first 3x3 is 1.
std::ostream & operator<<(std::ostream &s, const vpgl_local_rational_camera< T > &p)
Write to stream.
virtual vgl_ray_3d< T > backproject_ray(const vgl_homg_point_2d< T > &image_point) const
Find the 3d ray that goes through the camera center and the provided image point.
vgl_h_matrix_3d< T > get_canonical_h(vpgl_proj_camera< T > &camera)
Return the 3D H-matrix s.t. P * H = [I 0].
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
const vpgl_proj_camera< T > & operator=(const vpgl_proj_camera &cam)
Assignment.
vnl_matrix_fixed< T, 4, 4 > const & get_matrix() const
const vnl_matrix_fixed< T, 3, 4 > & get_matrix() const
Return a copy of the camera matrix.
virtual void save(std::string cam_path)
Save in ascii format.
vgl_homg_point_2d< T > project(const vgl_point_3d< T > &world_point) const
Non-homogeneous version of the above.
vgl_line_2d< T > operator()(const vgl_infinite_line_3d< T > &world_line) const
Standard () forward projection operator.
vgl_homg_point_2d< T > z_vanishing_point() const
std::string type_name() const override
class identity functions for casting.
vpgl_proj_camera()
Default constructor makes an identity camera.