This class implements the perspective camera class as described in Hartley & Zisserman as a finite camera. More...
#include <vpgl_perspective_camera.h>

Public Member Functions | |
| vpgl_perspective_camera () | |
| Default constructor. More... | |
| vpgl_perspective_camera (const vpgl_calibration_matrix< T > &K, const vgl_point_3d< T > &camera_center, vgl_rotation_3d< T > R) | |
| Main constructor takes all of the camera parameters. More... | |
| vpgl_perspective_camera (const vpgl_calibration_matrix< T > &K, vgl_rotation_3d< T > R, const vgl_vector_3d< T > &t) | |
| Main constructor based on K[R|t]. More... | |
| vpgl_perspective_camera (const vpgl_perspective_camera &cam) | |
| Copy constructor. More... | |
| ~vpgl_perspective_camera () override=default | |
| Destructor. More... | |
| std::string | type_name () const override |
| class identity functions for casting. More... | |
| vpgl_proj_camera< T > * | clone (void) const override |
| Clone ‘this’: creation of a new object and initialization. More... | |
| vgl_homg_line_3d_2_points< T > | backproject (const vgl_homg_point_2d< T > &image_point) const override |
| Finite backprojection. More... | |
| vgl_line_3d_2_points< T > | backproject (const vgl_point_2d< T > &image_point) const |
| Finite backprojection. More... | |
| vgl_line_3d_2_points< T > | backproject (T u, T v) const |
| Finite backprojection. More... | |
| vgl_ray_3d< T > | backproject_ray (const vgl_point_2d< T > &image_point) const |
| Finite ray backprojection. More... | |
| vgl_ray_3d< T > | backproject_ray (T u, T v) const |
| Finite ray backprojection at u v. More... | |
| vgl_vector_3d< T > | principal_axis () const |
| Compute the principal axis. More... | |
| 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. More... | |
| void | set_calibration (const vpgl_calibration_matrix< T > &K) |
| Setters and getters. More... | |
| void | set_camera_center (const vgl_point_3d< T > &camera_center) |
| void | set_translation (const vgl_vector_3d< T > &t) |
| void | set_rotation (const vgl_rotation_3d< T > &R) |
| const vpgl_calibration_matrix< T > & | get_calibration () const |
| const vgl_point_3d< T > & | get_camera_center () const |
| vgl_vector_3d< T > | get_translation () const |
| const vgl_rotation_3d< T > & | get_rotation () const |
| 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. More... | |
| vgl_homg_point_3d< T > | camera_center () const override |
| Return the known camera center instead of computing it in the base class. More... | |
| bool | operator== (vpgl_perspective_camera< T > const &that) const |
| Equality test. More... | |
| void | save (std::string cam_path) override |
| Save in ascii format. More... | |
| virtual vpgl_perspective_camera< T > * | cast_to_perspective_camera () |
| Return ‘this’ if ‘this’ is a vpgl_perspective_camera, 0 otherwise. More... | |
| virtual const vpgl_perspective_camera< T > * | cast_to_perspective_camera () const |
| bool | operator== (vpgl_proj_camera< T > const &that) const |
| Equality test. More... | |
| void | project (const T x, const T y, const T z, T &u, T &v) const override |
| Projection from base class. More... | |
| virtual vgl_homg_point_2d< T > | project (const vgl_homg_point_3d< T > &world_point) const |
| Project a point in world coordinates onto the image plane. More... | |
| vgl_homg_point_2d< T > | project (const vgl_point_3d< T > &world_point) const |
| Non-homogeneous version of the above. More... | |
| vgl_line_segment_2d< T > | project (const vgl_line_segment_3d< T > &world_line) const |
| Project a line in the world onto a line in the image plane. More... | |
| vgl_line_2d< T > | project (const vgl_infinite_line_3d< T > &world_line) const |
| Project an infinite line in the world onto an infinite line in the image plane. More... | |
| vgl_homg_point_2d< T > | operator() (const vgl_homg_point_3d< T > &world_point) const |
| A shortcut to the above function. More... | |
| vgl_line_segment_2d< T > | operator() (const vgl_line_segment_3d< T > &world_line) const |
| Standard () forward projection operator. More... | |
| vgl_line_2d< T > | operator() (const vgl_infinite_line_3d< T > &world_line) const |
| Standard () forward projection operator. More... | |
| 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. More... | |
| vgl_homg_plane_3d< T > | backproject (const vgl_homg_line_2d< T > &image_line) const |
| Find the 3d plane that contains the camera center and the provided line in the image plane. More... | |
| virtual vgl_homg_plane_3d< T > | principal_plane () const |
| Find the world plane parallel to the image plane intersecting the camera center. More... | |
| vgl_homg_point_2d< T > | x_vanishing_point () const |
| Find the image coordinates of the vanishing points of the world coordinate axes. More... | |
| vgl_homg_point_2d< T > | y_vanishing_point () const |
| vgl_homg_point_2d< T > | z_vanishing_point () const |
| const vnl_matrix_fixed< T, 3, 4 > & | get_matrix () const |
| Return a copy of the camera matrix. More... | |
| vnl_svd< T > * | svd () const |
| Get a copy of the svd of the get_matrix. More... | |
| 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. More... | |
| virtual bool | set_matrix (const T *new_camera_matrix) |
| std::string | is_a () const |
| bool | is_class (std::string const &name) const |
| void | ref () |
| void | unref () |
| long | get_references () const |
| bool | is_referenced () const |
Static Public Member Functions | |
| 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. More... | |
| static vpgl_perspective_camera< T > | postmultiply (const vpgl_perspective_camera< T > &camera, const vgl_rotation_3d< T > &rot, const vgl_vector_3d< T > &trans) |
| Apply a 3-d Euclidean transformation (transform external cam parameters). More... | |
Protected Member Functions | |
| void | recompute_matrix () |
| Recalculate the 3x4 camera matrix from the parameters. More... | |
Protected Attributes | |
| vpgl_calibration_matrix< T > | K_ |
| vgl_point_3d< T > | camera_center_ |
| vgl_rotation_3d< T > | R_ |
This class implements the perspective camera class as described in Hartley & Zisserman as a finite camera.
This is the camera model based on three objects: the camera calibration matrix (see "vpgl_calibration_matrix.h"), the camera center, and the rotation of the camera from its canonical orientation staring down the positive z axis.
All rotation matrices entered will be checked that they are indeed rotations, i.e. that R.transpose()*R = Identity and in the form:
[ R 0 ] [ 0 1 ]
Modifications Feb 12, 2007 Thomas Pollard Added finite backprojection method.
For adding to this class:
Be sure to call recompute_matrix in your member functions any time you change any of the camera parameters.
Definition at line 59 of file vpgl_perspective_camera.h.
| vpgl_perspective_camera< T >::vpgl_perspective_camera | ( | ) |
Default constructor.
Makes a camera at the origin with no rotation and default calibration matrix.
Definition at line 38 of file vpgl_perspective_camera.hxx.
| vpgl_perspective_camera< T >::vpgl_perspective_camera | ( | const vpgl_calibration_matrix< T > & | K, |
| const vgl_point_3d< T > & | camera_center, | ||
| vgl_rotation_3d< T > | R | ||
| ) |
Main constructor takes all of the camera parameters.
Definition at line 48 of file vpgl_perspective_camera.hxx.
| vpgl_perspective_camera< T >::vpgl_perspective_camera | ( | const vpgl_calibration_matrix< T > & | K, |
| vgl_rotation_3d< T > | R, | ||
| const vgl_vector_3d< T > & | t | ||
| ) |
Main constructor based on K[R|t].
Definition at line 59 of file vpgl_perspective_camera.hxx.
| vpgl_perspective_camera< T >::vpgl_perspective_camera | ( | const vpgl_perspective_camera< T > & | cam | ) |
Copy constructor.
Definition at line 71 of file vpgl_perspective_camera.hxx.
|
overridedefault |
Destructor.
|
overridevirtual |
Finite backprojection.
This is a virtual function from the parent class vpgl_proj_camera<T>
Reimplemented from vpgl_proj_camera< T >.
Definition at line 88 of file vpgl_perspective_camera.hxx.
| vgl_line_3d_2_points< T > vpgl_perspective_camera< T >::backproject | ( | const vgl_point_2d< T > & | image_point | ) | const |
Finite backprojection.
Definition at line 101 of file vpgl_perspective_camera.hxx.
|
inline |
Finite backprojection.
Definition at line 95 of file vpgl_perspective_camera.h.
|
inherited |
Find the 3d plane that contains the camera center and the provided line in the image plane.
Definition at line 178 of file vpgl_proj_camera.hxx.
| vgl_ray_3d< T > vpgl_perspective_camera< T >::backproject_ray | ( | const vgl_point_2d< T > & | image_point | ) | const |
Finite ray backprojection.
Definition at line 123 of file vpgl_perspective_camera.hxx.
|
inline |
Finite ray backprojection at u v.
Definition at line 109 of file vpgl_perspective_camera.h.
|
virtualinherited |
Find the 3d ray that goes through the camera center and the provided image point.
Reimplemented in vpgl_affine_camera< T >.
Definition at line 162 of file vpgl_proj_camera.hxx.
|
inlineoverridevirtual |
Return the known camera center instead of computing it in the base class.
Reimplemented from vpgl_proj_camera< T >.
Definition at line 138 of file vpgl_perspective_camera.h.
|
inlinevirtual |
Return ‘this’ if ‘this’ is a vpgl_perspective_camera, 0 otherwise.
This is used by e.g. the storage class
Definition at line 169 of file vpgl_perspective_camera.h.
|
inlinevirtual |
Definition at line 170 of file vpgl_perspective_camera.h.
|
overridevirtual |
Clone ‘this’: creation of a new object and initialization.
See Prototype pattern
Reimplemented from vpgl_proj_camera< T >.
Definition at line 81 of file vpgl_perspective_camera.hxx.
|
inline |
Definition at line 124 of file vpgl_perspective_camera.h.
|
inline |
Definition at line 125 of file vpgl_perspective_camera.h.
|
inlineinherited |
Return a copy of the camera matrix.
Definition at line 156 of file vpgl_proj_camera.h.
|
inline |
Definition at line 127 of file vpgl_perspective_camera.h.
| vgl_vector_3d< T > vpgl_perspective_camera< T >::get_translation | ( | ) | const |
Definition at line 189 of file vpgl_perspective_camera.hxx.
|
inlineinherited |
Definition at line 40 of file vpgl_camera.h.
| bool vpgl_perspective_camera< T >::is_behind_camera | ( | const vgl_homg_point_3d< T > & | world_point | ) | const |
Determine whether the given point lies in front of the principal plane.
Definition at line 142 of file vpgl_perspective_camera.hxx.
|
inlineinherited |
Definition at line 41 of file vpgl_camera.h.
| void vpgl_perspective_camera< T >::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.
The camera should also be rotated about its principal axis such that the vertical image direction is closest to up in the world
Definition at line 200 of file vpgl_perspective_camera.hxx.
|
inlineinherited |
A shortcut to the above function.
Definition at line 114 of file vpgl_proj_camera.h.
|
inlineinherited |
Standard () forward projection operator.
Definition at line 121 of file vpgl_proj_camera.h.
|
inlineinherited |
Standard () forward projection operator.
Definition at line 128 of file vpgl_proj_camera.h.
|
inlineinherited |
Equality test.
Definition at line 98 of file vpgl_proj_camera.h.
|
inline |
Equality test.
Definition at line 155 of file vpgl_perspective_camera.h.
|
static |
Post-multiply this perspective camera with a 3-d Euclidean transformation.
Definition at line 385 of file vpgl_perspective_camera.hxx.
|
static |
Apply a 3-d Euclidean transformation (transform external cam parameters).
Definition at line 412 of file vpgl_perspective_camera.hxx.
| vgl_vector_3d< T > vpgl_perspective_camera< T >::principal_axis | ( | ) | const |
Compute the principal axis.
i.e. the vector perpendicular to the image plane pointing towards the front of the camera.
Definition at line 131 of file vpgl_perspective_camera.hxx.
|
inlinevirtualinherited |
Find the world plane parallel to the image plane intersecting the camera center.
Reimplemented in vpgl_affine_camera< T >.
Definition at line 146 of file vpgl_proj_camera.h.
|
overridevirtualinherited |
Projection from base class.
Implements vpgl_camera< T >.
Definition at line 104 of file vpgl_proj_camera.hxx.
|
virtualinherited |
Project a point in world coordinates onto the image plane.
Definition at line 85 of file vpgl_proj_camera.hxx.
|
inlineinherited |
Non-homogeneous version of the above.
Definition at line 110 of file vpgl_proj_camera.h.
|
inherited |
Project a line in the world onto a line in the image plane.
Definition at line 121 of file vpgl_proj_camera.hxx.
|
inherited |
Project an infinite line in the world onto an infinite line in the image plane.
Definition at line 134 of file vpgl_proj_camera.hxx.
|
protected |
Recalculate the 3x4 camera matrix from the parameters.
Definition at line 252 of file vpgl_perspective_camera.hxx.
|
overridevirtual |
Save in ascii format.
Reimplemented from vpgl_proj_camera< T >.
Definition at line 460 of file vpgl_perspective_camera.hxx.
| void vpgl_perspective_camera< T >::set_calibration | ( | const vpgl_calibration_matrix< T > & | K | ) |
Setters and getters.
Definition at line 154 of file vpgl_perspective_camera.hxx.
| void vpgl_perspective_camera< T >::set_camera_center | ( | const vgl_point_3d< T > & | camera_center | ) |
Definition at line 162 of file vpgl_perspective_camera.hxx.
|
virtualinherited |
Setters mirror the constructors and return true if the setting was successful.
In subclasses these should be redefined so that they won't allow setting of matrices with improper form.
Reimplemented in vpgl_affine_camera< T >.
Definition at line 220 of file vpgl_proj_camera.hxx.
|
virtualinherited |
Reimplemented in vpgl_affine_camera< T >.
Definition at line 230 of file vpgl_proj_camera.hxx.
| void vpgl_perspective_camera< T >::set_rotation | ( | const vgl_rotation_3d< T > & | R | ) |
Definition at line 181 of file vpgl_perspective_camera.hxx.
| void vpgl_perspective_camera< T >::set_translation | ( | const vgl_vector_3d< T > & | t | ) |
Definition at line 171 of file vpgl_perspective_camera.hxx.
|
inherited |
Get a copy of the svd of the get_matrix.
The svd is cached when first computed and automatically recomputed when the matrix is changed.
Definition at line 203 of file vpgl_proj_camera.hxx.
|
inlineoverridevirtual |
class identity functions for casting.
Reimplemented from vpgl_camera< T >.
Definition at line 83 of file vpgl_perspective_camera.h.
|
inlineinherited |
Find the image coordinates of the vanishing points of the world coordinate axes.
Definition at line 149 of file vpgl_proj_camera.h.
|
inlineinherited |
Definition at line 150 of file vpgl_proj_camera.h.
|
inlineinherited |
Definition at line 151 of file vpgl_proj_camera.h.
|
protected |
Definition at line 177 of file vpgl_perspective_camera.h.
|
protected |
Definition at line 176 of file vpgl_perspective_camera.h.
|
protected |
Definition at line 178 of file vpgl_perspective_camera.h.
1.8.15