g2o
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
g2o::CameraParameters Class Reference

#include <parameter_cameraparameters.h>

Inheritance diagram for g2o::CameraParameters:
Inheritance graph
[legend]
Collaboration diagram for g2o::CameraParameters:
Collaboration graph
[legend]

Public Member Functions

 CameraParameters ()
 
 CameraParameters (double focal_length, const Vector2 &principle_point, double baseline)
 
Vector2 cam_map (const Vector3 &trans_xyz) const
 
Vector3 stereocam_uvu_map (const Vector3 &trans_xyz) const
 
bool read (std::istream &is)
 read the data from a stream
 
bool write (std::ostream &os) const
 write the data to a stream
 
- Public Member Functions inherited from g2o::Parameter
 Parameter ()
 
virtual ~Parameter ()
 
int id () const
 
void setId (int id_)
 
virtual HyperGraph::HyperGraphElementType elementType () const
 
- Public Member Functions inherited from g2o::HyperGraph::HyperGraphElement
virtual ~HyperGraphElement ()
 

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 
double focal_length
 
Vector2 principle_point
 
double baseline
 

Additional Inherited Members

- Protected Attributes inherited from g2o::Parameter
int _id
 

Detailed Description

Definition at line 38 of file parameter_cameraparameters.h.

Constructor & Destructor Documentation

◆ CameraParameters() [1/2]

g2o::CameraParameters::CameraParameters ( )

◆ CameraParameters() [2/2]

g2o::CameraParameters::CameraParameters ( double  focal_length,
const Vector2 principle_point,
double  baseline 
)

Member Function Documentation

◆ cam_map()

Vector2 g2o::CameraParameters::cam_map ( const Vector3 trans_xyz) const

Definition at line 59 of file parameter_cameraparameters.cpp.

59 {
60 Vector2 proj = project(trans_xyz);
61 Vector2 res;
62 res[0] = proj[0] * focal_length + principle_point[0];
63 res[1] = proj[1] * focal_length + principle_point[1];
64 return res;
65}
G2O_TYPES_SLAM3D_API Vector2 project(const Vector3 &)

References focal_length, principle_point, and g2o::project().

Referenced by g2o::EdgeProjectPSI2UV::computeError(), g2o::EdgeProjectXYZ2UV::computeError(), main(), and stereocam_uvu_map().

◆ read()

bool g2o::CameraParameters::read ( std::istream &  is)
virtual

read the data from a stream

Implements g2o::Parameter.

Definition at line 43 of file parameter_cameraparameters.cpp.

43 {
44 is >> focal_length;
45 is >> principle_point[0];
46 is >> principle_point[1];
47 is >> baseline;
48 return true;
49}

References baseline, focal_length, and principle_point.

◆ stereocam_uvu_map()

Vector3 g2o::CameraParameters::stereocam_uvu_map ( const Vector3 trans_xyz) const

Definition at line 67 of file parameter_cameraparameters.cpp.

67 {
68 Vector2 uv_left = cam_map(trans_xyz);
69 double proj_x_right = (trans_xyz[0] - baseline) / trans_xyz[2];
70 double u_right = proj_x_right * focal_length + principle_point[0];
71 return Vector3(uv_left[0], uv_left[1], u_right);
72}
Vector2 cam_map(const Vector3 &trans_xyz) const
VectorN< 3 > Vector3
Definition eigen_types.h:51

References baseline, cam_map(), focal_length, and principle_point.

Referenced by g2o::EdgeProjectXYZ2UVU::computeError().

◆ write()

bool g2o::CameraParameters::write ( std::ostream &  os) const
virtual

write the data to a stream

Implements g2o::Parameter.

Definition at line 51 of file parameter_cameraparameters.cpp.

51 {
52 os << focal_length << " ";
53 os << principle_point.x() << " ";
54 os << principle_point.y() << " ";
55 os << baseline << " ";
56 return true;
57}

References baseline, focal_length, and principle_point.

Member Data Documentation

◆ baseline

double g2o::CameraParameters::baseline

Definition at line 52 of file parameter_cameraparameters.h.

Referenced by read(), stereocam_uvu_map(), and write().

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

g2o::CameraParameters::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 40 of file parameter_cameraparameters.h.

◆ focal_length

double g2o::CameraParameters::focal_length

◆ principle_point

Vector2 g2o::CameraParameters::principle_point

Definition at line 51 of file parameter_cameraparameters.h.

Referenced by cam_map(), read(), stereocam_uvu_map(), and write().


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