MRPT  1.9.9
mrpt::img::TStereoCamera Class Reference

Detailed Description

Structure to hold the parameters of a pinhole stereo camera model.

The parameters obtained for one camera resolution can be used for any other resolution by means of the method TStereoCamera::scaleToResolution()

See also
mrpt::vision, the application stereo-calib-gui for calibrating a stereo camera

Definition at line 23 of file TStereoCamera.h.

#include <mrpt/img/TStereoCamera.h>

Inheritance diagram for mrpt::img::TStereoCamera:
Inheritance graph

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete (void *memory, void *ptr) noexcept
 
voidoperator new (size_t size, const std::nothrow_t &) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 
void saveToConfigFile (const std::string &section, mrpt::config::CConfigFileBase &cfg) const
 Save all params to a plain text config file in this format: More...
 
void loadFromConfigFile (const std::string &section, const mrpt::config::CConfigFileBase &cfg)
 Load all the params from a config source, in the same format that used in saveToConfigFile(). More...
 
void loadFromConfigFile (const mrpt::config::CConfigFileBase &cfg, const std::string &section)
 overload This signature is consistent with the rest of MRPT APIs More...
 
std::string dumpAsText () const
 Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile. More...
 
void scaleToResolution (unsigned int new_ncols, unsigned int new_nrows)
 Rescale all the parameters for a new camera resolution (it raises an exception if the aspect ratio is modified, which is not permitted). More...
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
RTTI classes and functions for polymorphic hierarchies
mrpt::rtti::CObject::Ptr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Public Attributes

TCamera leftCamera
 Intrinsic and distortion parameters of the left and right cameras. More...
 
TCamera rightCamera
 
mrpt::math::TPose3DQuat rightCameraPose
 Pose of the right camera with respect to the coordinate origin of the left camera. More...
 

Protected Member Functions

CSerializable virtual methods
uint8_t serializeGetVersion () const override
 Must return the current versioning number of the object. More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. More...
 

RTTI stuff

using Ptr = std::shared_ptr< TStereoCamera >
 
using ConstPtr = std::shared_ptr< const TStereoCamera >
 
using UniquePtr = std::unique_ptr< TStereoCamera >
 
using ConstUniquePtr = std::unique_ptr< const TStereoCamera >
 
static mrpt::rtti::CLASSINIT _init_TStereoCamera
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "TStereoCamera"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static mrpt::rtti::CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Member Typedef Documentation

◆ ConstPtr

using mrpt::img::TStereoCamera::ConstPtr = std::shared_ptr<const TStereoCamera >

Definition at line 25 of file TStereoCamera.h.

◆ ConstUniquePtr

using mrpt::img::TStereoCamera::ConstUniquePtr = std::unique_ptr<const TStereoCamera >

Definition at line 25 of file TStereoCamera.h.

◆ Ptr

using mrpt::img::TStereoCamera::Ptr = std::shared_ptr< TStereoCamera >

A type for the associated smart pointer

Definition at line 25 of file TStereoCamera.h.

◆ UniquePtr

using mrpt::img::TStereoCamera::UniquePtr = std::unique_ptr< TStereoCamera >

Definition at line 25 of file TStereoCamera.h.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::rtti::TRuntimeClassId* mrpt::img::TStereoCamera::_GetBaseClass ( )
staticprotected

◆ clone()

virtual mrpt::rtti::CObject* mrpt::img::TStereoCamera::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::rtti::CObject.

◆ Create()

template<typename... Args>
static Ptr mrpt::img::TStereoCamera::Create ( Args &&...  args)
inlinestatic

Definition at line 25 of file TStereoCamera.h.

◆ CreateObject()

static mrpt::rtti::CObject* mrpt::img::TStereoCamera::CreateObject ( )
static

◆ CreateUnique()

template<typename... Args>
static UniquePtr mrpt::img::TStereoCamera::CreateUnique ( Args &&...  args)
inlinestatic

Definition at line 25 of file TStereoCamera.h.

◆ dumpAsText()

std::string TStereoCamera::dumpAsText ( ) const

Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.

See also
saveToConfigFile

Definition at line 98 of file TStereoCamera.cpp.

References mrpt::config::CConfigFileMemory::getContent().

Referenced by mrpt::obs::CObservationStereoImages::getDescriptionAsText().

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 168 of file CObject.h.

References mrpt::rtti::CObject::clone().

Referenced by mrpt::obs::CRawlog::addActions(), and mrpt::obs::CRawlog::addObservations().

◆ getClassName()

static constexpr auto mrpt::img::TStereoCamera::getClassName ( )
inlinestatic

Definition at line 25 of file TStereoCamera.h.

◆ GetRuntimeClass()

virtual const mrpt::rtti::TRuntimeClassId* mrpt::img::TStereoCamera::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::serialization::CSerializable.

◆ GetRuntimeClassIdStatic()

static const mrpt::rtti::TRuntimeClassId& mrpt::img::TStereoCamera::GetRuntimeClassIdStatic ( )
static

◆ loadFromConfigFile() [1/2]

void TStereoCamera::loadFromConfigFile ( const std::string section,
const mrpt::config::CConfigFileBase cfg 
)

Load all the params from a config source, in the same format that used in saveToConfigFile().

Load all the params from a config source, in the format described in saveToConfigFile()

Notice that 3 different sections are read, of which "section" is only the prefix.

Exceptions
std::exceptionon missing fields

Definition at line 45 of file TStereoCamera.cpp.

References mrpt::config::CConfigFileBase::read_string().

Referenced by mrpt::hwdrivers::COpenNI2Sensor::loadConfig_sensorSpecific(), mrpt::hwdrivers::CKinect::loadConfig_sensorSpecific(), loadFromConfigFile(), and mrpt::hwdrivers::TCaptureOptions_DUO3D::loadOptionsFrom().

◆ loadFromConfigFile() [2/2]

void mrpt::img::TStereoCamera::loadFromConfigFile ( const mrpt::config::CConfigFileBase cfg,
const std::string section 
)
inline

overload This signature is consistent with the rest of MRPT APIs

Definition at line 70 of file TStereoCamera.h.

References loadFromConfigFile().

◆ operator delete() [1/3]

void mrpt::img::TStereoCamera::operator delete ( void ptr,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 25 of file TStereoCamera.h.

◆ operator delete() [2/3]

void mrpt::img::TStereoCamera::operator delete ( void ptr)
inlinenoexcept

Definition at line 25 of file TStereoCamera.h.

◆ operator delete() [3/3]

void mrpt::img::TStereoCamera::operator delete ( void memory,
void ptr 
)
inlinenoexcept

Definition at line 25 of file TStereoCamera.h.

◆ operator delete[]()

void mrpt::img::TStereoCamera::operator delete[] ( void ptr)
inlinenoexcept

Definition at line 25 of file TStereoCamera.h.

◆ operator new() [1/3]

void* mrpt::img::TStereoCamera::operator new ( size_t  size)
inline

Definition at line 25 of file TStereoCamera.h.

◆ operator new() [2/3]

void* mrpt::img::TStereoCamera::operator new ( size_t  size,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 25 of file TStereoCamera.h.

◆ operator new() [3/3]

static void* mrpt::img::TStereoCamera::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 25 of file TStereoCamera.h.

◆ operator new[]()

void* mrpt::img::TStereoCamera::operator new[] ( size_t  size)
inline

Definition at line 25 of file TStereoCamera.h.

◆ saveToConfigFile()

void TStereoCamera::saveToConfigFile ( const std::string section,
mrpt::config::CConfigFileBase cfg 
) const

Save all params to a plain text config file in this format:

Save as a config block:

[<SECTION>_LEFT]
resolution = [NCOLS NROWS]
cx = CX
cy = CY
fx = FX
fy = FY
dist = [K1 K2 T1 T2 K3]
[<SECTION>_RIGHT]
resolution = [NCOLS NROWS]
cx = CX
cy = CY
fx = FX
fy = FY
dist = [K1 K2 T1 T2 K3]
[<SECTION>_LEFT2RIGHT_POSE]
pose_quaternion = [x y z qr qx qy qz]

Notice that 3 different sections are read, of which "section" is only the prefix.

Definition at line 24 of file TStereoCamera.cpp.

References saveToConfigFile().

Referenced by saveToConfigFile().

◆ scaleToResolution()

void mrpt::img::TStereoCamera::scaleToResolution ( unsigned int  new_ncols,
unsigned int  new_nrows 
)
inline

Rescale all the parameters for a new camera resolution (it raises an exception if the aspect ratio is modified, which is not permitted).

Definition at line 83 of file TStereoCamera.h.

References leftCamera, rightCamera, and mrpt::img::TCamera::scaleToResolution().

◆ serializeFrom()

void TStereoCamera::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

Pure virtual method for reading (deserializing) from an abstract archive.

Users don't call this method directly. Instead, use stream >> object;.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 69 of file TStereoCamera.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, and THROW_EXCEPTION.

◆ serializeGetVersion()

uint8_t TStereoCamera::serializeGetVersion ( ) const
overrideprotectedvirtual

Must return the current versioning number of the object.

Start in zero for new classes, and increments each time there is a change in the stored format.

Implements mrpt::serialization::CSerializable.

Definition at line 62 of file TStereoCamera.cpp.

◆ serializeTo()

void TStereoCamera::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

Pure virtual method for writing (serializing) to an abstract archive.

Users don't call this method directly. Instead, use stream << object;.

Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 63 of file TStereoCamera.cpp.

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB.

Definition at line 68 of file CSerializable.h.

Member Data Documentation

◆ _init_TStereoCamera

mrpt::rtti::CLASSINIT mrpt::img::TStereoCamera::_init_TStereoCamera
staticprotected

Definition at line 25 of file TStereoCamera.h.

◆ className

constexpr const char* mrpt::img::TStereoCamera::className = "TStereoCamera"
static

Definition at line 25 of file TStereoCamera.h.

◆ leftCamera

◆ rightCamera

◆ rightCameraPose

◆ runtimeClassId

const mrpt::rtti::TRuntimeClassId mrpt::img::TStereoCamera::runtimeClassId
staticprotected

Definition at line 25 of file TStereoCamera.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020