summaryrefslogtreecommitdiff
path: root/src/camera.cpp
blob: a78746f1abfd15dc30f8b3f603f7435de89b8898 (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
/*
 * =====================================================================================
 *
 *       Filename:  camera.cpp
 *
 *    Description:  Class for camera
 *
 *        Version:  1.0
 *        Created:  03/19/2017 09:39:58 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Martin Miller (MHM), miller7@illinois.edu
 *   Organization:  Aerospace Robotics and Controls Lab (ARC)
 *
 * =====================================================================================
 */
#include "camera.h"
#include <iostream>

/*
 *--------------------------------------------------------------------------------------
 *       Class:  Camera
 *      Method:  Camera
 * Description:  constructor
 *--------------------------------------------------------------------------------------
 */
Camera::Camera (const char *fin)
{
    YAML::Node config = YAML::LoadFile(fin);
    _K(0,0) = BINNING*config["camera_matrix"]["data"][0].as<double>();
    _K(0,1) = BINNING*config["camera_matrix"]["data"][1].as<double>();
    _K(0,2) = BINNING*config["camera_matrix"]["data"][2].as<double>();
    _K(1,0) = BINNING*config["camera_matrix"]["data"][3].as<double>();
    _K(1,1) = BINNING*config["camera_matrix"]["data"][4].as<double>();
    _K(1,2) = BINNING*config["camera_matrix"]["data"][5].as<double>();
    _K(2,0) = BINNING*config["camera_matrix"]["data"][6].as<double>();
    _K(2,1) = BINNING*config["camera_matrix"]["data"][7].as<double>();
    _K(2,2) = config["camera_matrix"]["data"][8].as<double>();

    _d[0] = config["distortion_coefficients"]["data"][0].as<double>();
    _d[1] = config["distortion_coefficients"]["data"][1].as<double>();
    _d[2] = config["distortion_coefficients"]["data"][2].as<double>();
    _d[3] = config["distortion_coefficients"]["data"][3].as<double>();

}  /* -----  end of method Camera::Camera  (constructor)  ----- */


Matrix<double,3,3>
Camera::K (  )
{
    return _K ;
}		/* -----  end of method Camera::K  ----- */

Vector4d
Camera::d ( )
{
    return _d;
}		/* -----  end of method Camera::d  ----- */