2 #ifndef vpgl_perspective_camera_h_ 3 #define vpgl_perspective_camera_h_ 29 # include <vcl_msvc_warnings.h> 83 std::string
type_name()
const override {
return "vpgl_perspective_camera"; }
156 {
return this == &that ||
163 void save(std::string cam_path)
override;
184 template <
class Type>
188 template <
class Type>
192 template <
class Type>
241 #endif // vpgl_perspective_camera_h_ bool vpgl_perspective_decomposition(const vnl_matrix_fixed< T, 3, 4 > &camera_matrix, vpgl_perspective_camera< T > &p_camera)
Decompose camera into parameter blocks.
static vpgl_perspective_camera< T > postmultiply(const vpgl_perspective_camera< T > &in_cam, const vgl_h_matrix_3d< T > &euclid_trans)
Post-multiply this perspective camera with a 3-d Euclidean transformation.
void set_rotation(const vgl_rotation_3d< T > &R)
vgl_homg_line_3d_2_points< T > backproject(const vgl_homg_point_2d< T > &image_point) const override
Finite backprojection.
std::istream & operator>>(std::istream &is, vpgl_local_rational_camera< T > &p)
Read from stream.
vgl_ray_3d< T > backproject_ray(T u, T v) const
Finite ray backprojection at u v.
vgl_point_3d< T > camera_center_
vgl_vector_3d< T > principal_axis() const
Compute the principal axis.
std::string type_name() const override
class identity functions for casting.
void vrml_write(std::ostream &s, vpgl_perspective_camera< Type > const &p, double rad)
Write vpgl_perspective_camera to a vrml file, does not write a vrml header, only the camera,...
A class representing the "K" matrix of a perspective camera matrix as described in.
void set_camera_center(const vgl_point_3d< T > &camera_center)
vgl_frustum_3d< T > frustum(vpgl_perspective_camera< T > const &cam, T d_near, T d_far)
compute the frustrum of the camera view cone. The near plane.
void save(std::string cam_path) override
Save in ascii format.
const vpgl_calibration_matrix< T > & get_calibration() const
const vgl_rotation_3d< T > & get_rotation() const
~vpgl_perspective_camera() override=default
Destructor.
vpgl_perspective_camera< T > vpgl_align_up(const vpgl_perspective_camera< T > &p0, const vpgl_perspective_camera< T > &p1)
Changes the coordinate system of camera p1 such that the same change would transform K[I|0] to p0.
void set_calibration(const vpgl_calibration_matrix< T > &K)
Setters and getters.
vpgl_perspective_camera< T > postmultiply(const vpgl_perspective_camera< T > &in_cam, const vgl_h_matrix_3d< T > &euclid_trans)
virtual vpgl_perspective_camera< T > * cast_to_perspective_camera()
Return ‘this’ if ‘this’ is a vpgl_perspective_camera, 0 otherwise.
vgl_vector_3d< T > vpgl_persp_cam_base_line_vector(const vpgl_perspective_camera< T > &cam1, const vpgl_perspective_camera< T > &cam2)
void look_at(const vgl_homg_point_3d< T > &point, const vgl_vector_3d< T > &up=vgl_vector_3d< T >(0, 0, 1))
Rotate the camera about its center such that it looks at the given point.
vgl_rotation_3d< T > vpgl_persp_cam_relative_orientation(const vpgl_perspective_camera< T > &cam1, const vpgl_perspective_camera< T > &cam2)
compute rotation such that principal_vector1 = R*principal_vector2.
void recompute_matrix()
Recalculate the 3x4 camera matrix from the parameters.
vpgl_calibration_matrix< T > K_
const vgl_point_3d< T > & get_camera_center() const
vgl_homg_point_3d< T > camera_center() const override
Return the known camera center instead of computing it in the base class.
vgl_ray_3d< T > backproject_ray(const vgl_point_2d< T > &image_point) const
Finite ray backprojection.
std::ostream & operator<<(std::ostream &s, const vpgl_local_rational_camera< T > &p)
Write to stream.
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
vgl_line_3d_2_points< T > backproject(T u, T v) const
Finite backprojection.
A camera model using the standard 3x4 matrix representation.
bool is_behind_camera(const vgl_homg_point_3d< T > &world_point) const
Determine whether the given point lies in front of the principal plane.
const vnl_matrix_fixed< T, 3, 4 > & get_matrix() const
Return a copy of the camera matrix.
vpgl_perspective_camera()
Default constructor.
vpgl_proj_camera< T > * clone(void) const override
Clone ‘this’: creation of a new object and initialization.
void set_translation(const vgl_vector_3d< T > &t)
bool operator==(vpgl_perspective_camera< T > const &that) const
Equality test.
std::vector< vpgl_perspective_camera< T > > cameras_from_directory(std::string dir, T)
Return a list of camera's, loaded from the (name sorted) files from the given directory.
virtual const vpgl_perspective_camera< T > * cast_to_perspective_camera() const
double vpgl_persp_cam_distance(const vpgl_perspective_camera< T > &cam1, const vpgl_perspective_camera< T > &cam2)
vgl_vector_3d< T > get_translation() const
vpgl_perspective_camera< T > vpgl_align_down(const vpgl_perspective_camera< T > &p0, const vpgl_perspective_camera< T > &p1)
Changes the coordinate system of camera p1 such that the same change would transform p0 to K[I|0].
A class for the calibration matrix component of a perspective camera matrix.