class mrpt::img::TStereoCamera

Overview

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

#include <mrpt/img/TStereoCamera.h>

class TStereoCamera: public mrpt::serialization::CSerializable
{
public:
    // fields

    TCamera leftCamera;
    TCamera rightCamera;
    mrpt::math::TPose3DQuat rightCameraPose;

    // methods

    void saveToConfigFile(const std::string& section, mrpt::config::CConfigFileBase& cfg) const;
    void loadFromConfigFile(const std::string& section, const mrpt::config::CConfigFileBase& cfg);
    void loadFromConfigFile(const mrpt::config::CConfigFileBase& cfg, const std::string& section);
    std::string dumpAsText() const;
    void scaleToResolution(unsigned int new_ncols, unsigned int new_nrows);
};

Fields

TCamera leftCamera

Intrinsic and distortion parameters of the left and right cameras.

mrpt::math::TPose3DQuat rightCameraPose

Pose of the right camera with respect to the coordinate origin of the left camera.

Methods

void 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.

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().

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.

Parameters:

std::exception

on missing fields

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

overload This signature is consistent with the rest of MRPT APIs

std::string dumpAsText() const

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

See also:

saveToConfigFile

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).