Go to the documentation of this file.00001 #include "stereo_calibration.hpp"
00002
00003 #include <cstdio>
00004 #include <iostream>
00005
00006 #include <emmintrin.h>
00007
00008 #include "stereo_rectify.hpp"
00009
00010 namespace fovis
00011 {
00012
00013 StereoCalibration::StereoCalibration(const StereoCalibrationParameters& params) :
00014 _parameters(params)
00015 {
00016 initialize();
00017 }
00018
00019 StereoCalibration::~StereoCalibration()
00020 {
00021 delete _left_rectification;
00022 delete _right_rectification;
00023 }
00024
00025 void
00026 StereoCalibration::initialize()
00027 {
00028 Eigen::Quaterniond rotation_quat(_parameters.right_to_left_rotation[0],
00029 _parameters.right_to_left_rotation[1],
00030 _parameters.right_to_left_rotation[2],
00031 _parameters.right_to_left_rotation[3]);
00032 Eigen::Vector3d translation(_parameters.right_to_left_translation[0],
00033 _parameters.right_to_left_translation[1],
00034 _parameters.right_to_left_translation[2]);
00035
00036 Eigen::Matrix3d left_rotation, right_rotation;
00037 stereo_rectify(_parameters.left_parameters, _parameters.right_parameters,
00038 rotation_quat,
00039 translation,
00040 &left_rotation, &right_rotation, &_rectified_parameters);
00041
00042 _left_rectification = new Rectification(_parameters.left_parameters,
00043 left_rotation,
00044 _rectified_parameters);
00045
00046 _right_rectification = new Rectification(_parameters.right_parameters,
00047 right_rotation,
00048 _rectified_parameters);
00049 }
00050
00051 StereoCalibration* StereoCalibration::makeCopy() const {
00052 StereoCalibration* sc = new StereoCalibration();
00053 sc->_parameters = _parameters;
00054 sc->_rectified_parameters = _rectified_parameters;
00055 sc->_left_rectification = _left_rectification->makeCopy();
00056 sc->_right_rectification = _right_rectification->makeCopy();
00057 return sc;
00058 }
00059
00060
00061 }