bazar  1.3.1
Public Member Functions | Protected Attributes | List of all members
PerspectiveCamera Class Reference

#include <camera.h>

Inheritance diagram for PerspectiveCamera:
Inheritance graph
[legend]
Collaboration diagram for PerspectiveCamera:
Collaboration graph
[legend]

Public Member Functions

 PerspectiveCamera ()
void worldToImage (const double p[3], double uvw[3]) const
void worldToImage (const Vec3 &p, Vec3 &uvw) const
void worldToEye (const Vec3 &src, Vec3 &dst) const
void worldToEye (const double src[3], double dst[3]) const
void eyeToWorld (const Vec3 &uvw, Vec3 &w) const
void imageToWorld (double u, double v, Vec3 &w, double z=0) const
void setGlModelView () const
void setByTarget (const Vec3 pos, const Vec3 target, double roll)
void loadTdir (const double tdir[3][4], int w, int h)
bool loadTdir (const char *tdir, int w, int h)
bool loadTdir (const char *tdir)
void clearExternalParams ()
void translate (double dx, double dy, double dz)
 translate the camera relative to eye coordinates (z means "move forward").
void setWorldToEyeMat (const Mat3x4 &m)
const Mat3x4getWorldToEyeMat () const
const Mat3x4getEyeToWorldMat () const
const Mat3x4getWorldToImageMat () const
void cmpWorldToImageMat ()
bool saveTdir (const char *file)
 Save the camera in a tdir file. Returns true on success, false on failure.
- Public Member Functions inherited from PerspectiveProjection
 PerspectiveProjection ()
 PerspectiveProjection (int w, int h, double f, double g, double cx, double, double s=0)
void set (int w, int h, double f, double g, double cx, double cy, double s=0)
void eyeToImage (const double eye[3], double uv[2]) const
void imageToEye (const double uv[2], double eye[3], double w=0) const
void imageToEye (double u, double v, double eye[3], double w=0) const
void setGlProjection () const
bool setPlanes (double near, double far)
bool getUndistortMap (CvMat *xmap, CvMat *ymap)
void cmpEyeToImageMat ()
void flip ()

Protected Attributes

Mat3x4 worldToEyeMat
Mat3x4 eyeToWorldMat
Mat3x4 worldToImageMat

Additional Inherited Members

- Public Attributes inherited from PerspectiveProjection
double f
double g
double cx
double cy
double s
double distortion
Mat3x3 eyeToImageMat
int width
int height
double farPlane
double nearPlane

Detailed Description

Perspective camera: a projection located in space.

Examples:
multigl.cpp.

Definition at line 56 of file camera.h.

Constructor & Destructor Documentation

PerspectiveCamera::PerspectiveCamera ( )

Definition at line 191 of file camera.cpp.

Member Function Documentation

void PerspectiveCamera::clearExternalParams ( )

Definition at line 484 of file camera.cpp.

void PerspectiveCamera::cmpWorldToImageMat ( )

Definition at line 490 of file camera.cpp.

void PerspectiveCamera::eyeToWorld ( const Vec3 uvw,
Vec3 w 
) const

Definition at line 496 of file camera.cpp.

References Vec3::setMul().

const Mat3x4& PerspectiveCamera::getEyeToWorldMat ( ) const
inline

Definition at line 78 of file camera.h.

References eyeToWorldMat.

const Mat3x4& PerspectiveCamera::getWorldToEyeMat ( ) const
inline
Examples:
multigl.cpp.

Definition at line 77 of file camera.h.

References worldToEyeMat.

Referenced by operator<<(), and photo_draw().

const Mat3x4& PerspectiveCamera::getWorldToImageMat ( ) const
inline

Definition at line 79 of file camera.h.

References worldToImageMat.

void PerspectiveCamera::imageToWorld ( double  u,
double  v,
Vec3 w,
double  z = 0 
) const

Definition at line 501 of file camera.cpp.

References Vec3::v.

void PerspectiveCamera::loadTdir ( const double  _tdir[3][4],
int  w,
int  h 
)

This function separate intrinsic and extrinsic parameters from a single projection matrix. The resulting rotation matrix (worldToEyeMat) determinant is always positive.

Examples:
multigl.cpp.

Definition at line 295 of file camera.cpp.

References get3x3MulWithTransposed().

Referenced by photo_draw().

bool PerspectiveCamera::loadTdir ( const char *  tdirFile,
int  w,
int  h 
)

Load external and internal parameters from a tdir file. The w and h specify the size of the projection rectangle.

Returns
true on success, false on failure.

Definition at line 356 of file camera.cpp.

bool PerspectiveCamera::loadTdir ( const char *  tdirFile)

Load external and internal parameters from a tdir file, estimating image width and height.

THE WIDTH AND HEIGHT ESTIMATION MIGHT BE WRONG!

Returns
true on success, false on failure.

Definition at line 450 of file camera.cpp.

References diagDiff(), GuessMode::h, and GuessMode::w.

bool PerspectiveCamera::saveTdir ( const char *  file)

Save the camera in a tdir file. Returns true on success, false on failure.

Definition at line 522 of file camera.cpp.

void PerspectiveCamera::setByTarget ( const Vec3  pos,
const Vec3  target,
double  roll 
)

Definition at line 238 of file camera.cpp.

References Vec3::normalize(), Vec3::setCross(), and Vec3::setSub().

void PerspectiveCamera::setGlModelView ( ) const
Examples:
multigl.cpp.

Definition at line 219 of file camera.cpp.

Referenced by photo_draw().

void PerspectiveCamera::setWorldToEyeMat ( const Mat3x4 m)
Examples:
multigl.cpp.

Definition at line 516 of file camera.cpp.

Referenced by photo_draw().

void PerspectiveCamera::translate ( double  dx,
double  dy,
double  dz 
)

translate the camera relative to eye coordinates (z means "move forward").

Definition at line 508 of file camera.cpp.

void PerspectiveCamera::worldToEye ( const Vec3 src,
Vec3 dst 
) const

Definition at line 209 of file camera.cpp.

References Vec3::setMul().

void PerspectiveCamera::worldToEye ( const double  src[3],
double  dst[3] 
) const

Definition at line 214 of file camera.cpp.

void PerspectiveCamera::worldToImage ( const double  p[3],
double  uvw[3] 
) const

Definition at line 204 of file camera.cpp.

void PerspectiveCamera::worldToImage ( const Vec3 p,
Vec3 uvw 
) const

Definition at line 197 of file camera.cpp.

References Vec3::setMul(), and Vec3::v.

Member Data Documentation

Mat3x4 PerspectiveCamera::eyeToWorldMat
protected

Definition at line 89 of file camera.h.

Referenced by getEyeToWorldMat().

Mat3x4 PerspectiveCamera::worldToEyeMat
protected

Definition at line 88 of file camera.h.

Referenced by getWorldToEyeMat().

Mat3x4 PerspectiveCamera::worldToImageMat
protected

Definition at line 90 of file camera.h.

Referenced by getWorldToImageMat().


The documentation for this class was generated from the following files: