Classes | Functions
contrib/gel/mrc/vpgl/vpgl_proj_camera.h File Reference

A camera model using the standard 3x4 matrix representation. More...

#include <vnl/vnl_fwd.h>
#include <vgl/vgl_fwd.h>
#include <vnl/vnl_matrix_fixed.h>
#include <vnl/algo/vnl_svd.h>
#include <vgl/vgl_homg_point_3d.h>
#include <vgl/vgl_homg_point_2d.h>
#include <vgl/vgl_line_segment_2d.h>
#include <vgl/vgl_line_segment_3d.h>
#include <vgl/vgl_infinite_line_3d.h>
#include <vgl/vgl_homg_line_2d.h>
#include <vgl/vgl_line_2d.h>
#include <vgl/vgl_homg_line_3d_2_points.h>
#include <vgl/vgl_homg_plane_3d.h>
#include <vgl/algo/vgl_h_matrix_2d.h>
#include <vgl/algo/vgl_h_matrix_3d.h>
#include <vcl_iosfwd.h>
#include <vsl/vsl_binary_io.h>
#include "vpgl_camera.h"

Go to the source code of this file.

Classes

class  vpgl_proj_camera< T >

Functions

template<class T >
vgl_h_matrix_3d< T > get_canonical_h (vpgl_proj_camera< T > &camera)
 Return the 3D H-matrix s.t. P * H = [I 0].
template<class T >
void fix_cheirality (vpgl_proj_camera< T > &camera)
 Scale the camera matrix so determinant of first 3x3 is 1.
template<class T >
void make_cannonical (vpgl_proj_camera< T > &camera)
 Set the camera matrix to [ I | 0 ].
template<class T >
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.
template<class T >
vpgl_proj_camera< T > premultiply (const vpgl_proj_camera< T > &in_camera, const vgl_h_matrix_2d< T > &transform)
 Pre-multiply this projection matrix with a 2-d projective transform.
template<class T >
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.
template<class T >
vpgl_proj_camera< T > postmultiply (const vpgl_proj_camera< T > &in_camera, const vgl_h_matrix_3d< T > &transform)
 Post-multiply this projection matrix with a 3-d projective transform.
template<class T >
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.
template<class T >
vcl_vector< vnl_matrix_fixed
< T, 2, 3 > > 
image_jacobians (const vpgl_proj_camera< T > &camera, const vcl_vector< vgl_point_3d< T > > &pts)
 Compute the image projection Jacobians at each point.
template<class Type >
vcl_ostream & operator<< (vcl_ostream &s, vpgl_proj_camera< Type > const &p)
 Write vpgl_perspective_camera to stream.
template<class Type >
vcl_istream & operator>> (vcl_istream &s, vpgl_proj_camera< Type > &p)
 Read vpgl_perspective_camera from stream.
template<class T >
void vsl_add_to_binary_loader (vpgl_proj_camera< T > const &b)
 Allows derived class to be loaded by base-class pointer.

Detailed Description

A camera model using the standard 3x4 matrix representation.

Author:
Thomas Pollard
Date:
January 28, 2005
Author:
Joseph Mundy, Matt Leotta, Vishal Jain
    Modifications
    May 6, 2005  Ricardo Fabbri   Added binary I/O
   

This is the most general camera class based around the 3x4 matrix camera model. In reality the 3x4 matrix should be rank 3, but this is only checked when an action needing an SVD decomposition is called, and only gives a warning.

Once the camera is constructed, the camera matrix can only be accessed through the "get_matrix" and "set_matrix" functions. These are also the only ways for subclasses to access the matrix, as the automatic SVD handling is done in them.

Some camera operations require an SVD decomposition of the camera matrix. When such a function is first called, an SVD is automatically computed and cached for all future calls. When the camera matrix is changed by "set_matrix", the cached SVD is automatically nulled and will only be recomputed when another function that needs it is called. The SVD can be viewed at any time via the "svd" function.

Only elementary methods on the camera are included in the class itself. In addition, there several external functions at the end of the file for important camera operations deemed too specialized to be included in the vpgl_proj_camera class itself. Some functions lifted from vgl_p_matrix.h.

NOTE FOR DEVELOPERS: If you write any member functions that change the underlying matrix P_ you should call set_matrix to change it, rather than changing P_ itself. The automatic SVD caching will be screwed up otherwise.

Definition in file vpgl_proj_camera.h.


Function Documentation

template<class T >
void fix_cheirality ( vpgl_proj_camera< T > &  camera)

Scale the camera matrix so determinant of first 3x3 is 1.

Definition at line 314 of file vpgl_proj_camera.txx.

template<class T >
vgl_h_matrix_3d<T> get_canonical_h ( vpgl_proj_camera< T > &  camera)

Return the 3D H-matrix s.t. P * H = [I 0].

Definition at line 296 of file vpgl_proj_camera.txx.

template<class T >
vcl_vector<vnl_matrix_fixed<T,2,3> > image_jacobians ( const vpgl_proj_camera< T > &  camera,
const vcl_vector< vgl_point_3d< T > > &  pts 
)

Compute the image projection Jacobians at each point.

The returned matrices map a differential change in 3D to a differential change in the 2D image at each specified 3D point

Definition at line 372 of file vpgl_proj_camera.txx.

template<class T >
void make_cannonical ( vpgl_proj_camera< T > &  camera)

Set the camera matrix to [ I | 0 ].

Definition at line 321 of file vpgl_proj_camera.txx.

template<class Type >
vcl_ostream& operator<< ( vcl_ostream &  s,
vpgl_proj_camera< Type > const &  p 
)

Write vpgl_perspective_camera to stream.

Definition at line 258 of file vpgl_proj_camera.txx.

template<class Type >
vcl_istream& operator>> ( vcl_istream &  s,
vpgl_proj_camera< Type > &  p 
)

Read vpgl_perspective_camera from stream.

Definition at line 269 of file vpgl_proj_camera.txx.

template<class T >
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.

Definition at line 338 of file vpgl_proj_camera.txx.

template<class T >
vpgl_proj_camera<T> postmultiply ( const vpgl_proj_camera< T > &  in_camera,
const vgl_h_matrix_3d< T > &  transform 
)

Post-multiply this projection matrix with a 3-d projective transform.

Definition at line 241 of file vpgl_proj_camera.h.

template<class T >
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.

Definition at line 330 of file vpgl_proj_camera.txx.

template<class T >
vpgl_proj_camera<T> premultiply ( const vpgl_proj_camera< T > &  in_camera,
const vgl_h_matrix_2d< T > &  transform 
)

Pre-multiply this projection matrix with a 2-d projective transform.

Definition at line 227 of file vpgl_proj_camera.h.

template<class T >
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.

Definition at line 346 of file vpgl_proj_camera.txx.

template<class T >
void vsl_add_to_binary_loader ( vpgl_proj_camera< T > const &  b)

Allows derived class to be loaded by base-class pointer.

A loader object exists which is invoked by calls of the form "vsl_b_read(os,base_ptr)". This loads derived class objects from the disk, places them on the heap and returns a base class pointer. In order to work the loader object requires an instance of each derived class that might be found. This function gives the model class to the appropriate loader.

A loader object exists which is invoked by calls of the form "vsl_b_read(os,base_ptr);". This loads derived class objects from the stream, places them on the heap and returns a base class pointer. In order to work the loader object requires an instance of each derived class that might be found. This function gives the model class to the appropriate loader.

Definition at line 289 of file vpgl_proj_camera.txx.