Macros | Functions
vpgl_perspective_camera.hxx File Reference
#include <algorithm>
#include <fstream>
#include <iostream>
#include <utility>
#include "vpgl_perspective_camera.h"
#include <vgl/vgl_point_2d.h>
#include <vgl/vgl_vector_3d.h>
#include <vgl/vgl_homg_plane_3d.h>
#include <vgl/vgl_line_3d_2_points.h>
#include <vgl/algo/vgl_h_matrix_3d.h>
#include <vnl/vnl_det.h>
#include <vnl/algo/vnl_qr.h>
#include <vnl/vnl_matrix_fixed.h>
#include <vul/vul_file.h>
#include <vul/vul_file_iterator.h>
#include <cassert>
#include <vnl/vnl_trace.h>

Go to the source code of this file.

Macros

#define vpgl_PERSPECTIVE_CAMERA_INSTANTIATE(T)
 

Functions

template<class T >
bool vpgl_perspective_decomposition (const vnl_matrix_fixed< T, 3, 4 > &camera_matrix, vpgl_perspective_camera< T > &p_camera)
 Decompose camera into parameter blocks. More...
 
template<class T >
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]. More...
 
template<class T >
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. More...
 
template<class Type >
std::ostream & operator<< (std::ostream &s, vpgl_perspective_camera< Type > const &p)
 Write vpgl_perspective_camera to stream. More...
 
template<class Type >
std::istream & operator >> (std::istream &s, vpgl_perspective_camera< Type > &p)
 Read camera from stream. More...
 
template<class Type >
void vrml_write (std::ostream &str, vpgl_perspective_camera< Type > const &p, double rad)
 Write vpgl_perspective_camera to a vrml file. More...
 
template<class T >
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. More...
 
template<class T >
double vpgl_persp_cam_distance (const vpgl_perspective_camera< T > &cam1, const vpgl_perspective_camera< T > &cam2)
 
template<class T >
vgl_vector_3d< T > vpgl_persp_cam_base_line_vector (const vpgl_perspective_camera< T > &cam1, const vpgl_perspective_camera< T > &cam2)
 
template<class T >
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. More...
 
template<class T >
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. More...
 

Macro Definition Documentation

◆ vpgl_PERSPECTIVE_CAMERA_INSTANTIATE

#define vpgl_PERSPECTIVE_CAMERA_INSTANTIATE (   T)
Value:
template class vpgl_perspective_camera<T >; \
template bool vpgl_perspective_decomposition(const vnl_matrix_fixed<T,3,4>& camera_matrix, \
const vgl_h_matrix_3d<T >& euclid_trans); \
template void vrml_write(std::ostream &s, const vpgl_perspective_camera<T >&, double rad); \
template std::vector<vpgl_perspective_camera<T > > cameras_from_directory(std::string dir, T); \
template vgl_frustum_3d<T> frustum(vpgl_perspective_camera<T> const& cam, T d_near, T d_far); \
template std::ostream& operator<<(std::ostream&, const vpgl_perspective_camera<T >&); \
template std::istream& operator>>(std::istream&, vpgl_perspective_camera<T >&)
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.
std::istream & operator>>(std::istream &is, vpgl_local_rational_camera< T > &p)
Read from stream.
void vrml_write(std::ostream &str, vpgl_perspective_camera< Type > const &p, double rad)
Write vpgl_perspective_camera to a vrml file.
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].
vgl_vector_3d< T > vpgl_persp_cam_base_line_vector(const vpgl_perspective_camera< T > &cam1, const vpgl_perspective_camera< T > &cam2)
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.
vpgl_perspective_camera< T > postmultiply(const vpgl_perspective_camera< T > &in_cam, const vgl_h_matrix_3d< T > &euclid_trans)
double vpgl_persp_cam_distance(const vpgl_perspective_camera< T > &cam1, const vpgl_perspective_camera< T > &cam2)
bool vpgl_perspective_decomposition(const vnl_matrix_fixed< T, 3, 4 > &camera_matrix, vpgl_perspective_camera< T > &p_camera)
Decompose camera into parameter blocks.
std::ostream & operator<<(std::ostream &s, const vpgl_local_rational_camera< T > &p)
Write to stream.
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.
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
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.

Definition at line 618 of file vpgl_perspective_camera.hxx.

Function Documentation

◆ cameras_from_directory()

template<class T >
std::vector<vpgl_perspective_camera<T> > cameras_from_directory ( std::string  dir,
 
)

Return a list of camera's, loaded from the (name sorted) files from the given directory.

Definition at line 531 of file vpgl_perspective_camera.hxx.

◆ frustum()

template<class T >
vgl_frustum_3d<T> frustum ( vpgl_perspective_camera< T > const &  cam,
d_near,
d_far 
)

compute the frustrum of the camera view cone. The near plane.

the far plane distances are user defined.

Definition at line 595 of file vpgl_perspective_camera.hxx.

◆ operator >>()

template<class Type >
std::istream& operator >> ( std::istream &  s,
vpgl_perspective_camera< Type > &  p 
)

Read camera from stream.

Definition at line 441 of file vpgl_perspective_camera.hxx.

◆ operator<<()

template<class Type >
std::ostream& operator<< ( std::ostream &  s,
vpgl_perspective_camera< Type > const &  p 
)

Write vpgl_perspective_camera to stream.

Definition at line 426 of file vpgl_perspective_camera.hxx.

◆ vpgl_align_down()

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

Definition at line 340 of file vpgl_perspective_camera.hxx.

◆ vpgl_align_up()

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

Definition at line 359 of file vpgl_perspective_camera.hxx.

◆ vpgl_persp_cam_base_line_vector()

template<class T >
vgl_vector_3d<T> vpgl_persp_cam_base_line_vector ( const vpgl_perspective_camera< T > &  cam1,
const vpgl_perspective_camera< T > &  cam2 
)

Definition at line 578 of file vpgl_perspective_camera.hxx.

◆ vpgl_persp_cam_distance()

template<class T >
double vpgl_persp_cam_distance ( const vpgl_perspective_camera< T > &  cam1,
const vpgl_perspective_camera< T > &  cam2 
)

Definition at line 567 of file vpgl_perspective_camera.hxx.

◆ vpgl_persp_cam_relative_orientation()

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

Definition at line 585 of file vpgl_perspective_camera.hxx.

◆ vpgl_perspective_decomposition()

template<class T >
bool vpgl_perspective_decomposition ( const vnl_matrix_fixed< T, 3, 4 > &  camera_matrix,
vpgl_perspective_camera< T > &  p_camera 
)

Decompose camera into parameter blocks.

Attempts to decompose a 3x4 camera matrix into the parameter blocks that describe a perspective camera, but will only work if the supplied matrix has a left 3x3 submatrix with rank 3.

Definition at line 270 of file vpgl_perspective_camera.hxx.

◆ vrml_write()

template<class Type >
void vrml_write ( std::ostream &  str,
vpgl_perspective_camera< Type > const &  p,
double  rad 
)

Write vpgl_perspective_camera to a vrml file.

Write vpgl_perspective_camera to a vrml file, does not write a vrml header, only the camera, the camera center sphere has radius rad.

Definition at line 473 of file vpgl_perspective_camera.hxx.