summaryrefslogtreecommitdiff
path: root/src/camera.h
blob: 51e4e8a91af2f7b011009ea5f79eabd1fea54f83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef  camera_INC
#define  camera_INC
#include <opencv2/core.hpp>
#include <Eigen/Dense>
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <yaml-cpp/yaml.h>

#include "types.h"
#define BINNING 0.5 // set the binning factor
#define YAWCORRECT 1.0
//#define DOYAWCORRECT
using Eigen::Matrix;
using Eigen::Vector4d;
using Eigen::Vector3d;
using Eigen::Quaterniond;
using std::cout;
using std::cerr;
using std::endl;

/*
 * =====================================================================================
 *        Class:  Camera
 *  Description:  Class for the camera.
 * =====================================================================================
 */
class Camera
{
    public:
        /* ====================  LIFECYCLE     ======================================= */
	EIGEN_MAKE_ALIGNED_OPERATOR_NEW
        Camera (const char *fin);                             /* constructor */

        /* ====================  ACCESSORS     ======================================= */
        Vector4d d() const;
        cv::Vec4d d( int x ) const;
        Matrix<double,3,3> K() const;
        cv::Matx33d K(int x) const;
        Matrix<double,4,4> K4() const;
        Vector3d principalPoint() const;
        Matrix<double,3,3> Rc2b() const;
        Matrix<double,4,4> Rc2b4() const;

        /* ====================  MUTATORS      ======================================= */

        /* ====================  OPERATORS     ======================================= */
        Vector3d img2body(const Vector3d &xi) const;
        Vector3d body2img(const Vector3d &xb) const;
        cv::Mat warpPatch(const cv::Mat &p, const Quaterniond &q0, const Quaterniond &q1) const;
        cv::Mat reflectPatch( const cv::Mat &p, const Quaterniond &q0, const Quaterniond &q1 ) const;

    protected:
        /* ====================  METHODS       ======================================= */
        double roll(const Quaterniond &q) const;
        double pitch(const Quaterniond &q) const;

        /* ====================  DATA MEMBERS  ======================================= */

    private:
        /* ====================  METHODS       ======================================= */

        /* ====================  DATA MEMBERS  ======================================= */
        Matrix<double,3,3> _K;
        Matrix<double,4,4> _T;
        Vector4d _d;

}; /* -----  end of class Camera  ----- */


#endif   /* ----- #ifndef camera_INC  ----- */