2 #ifndef LVR2_IO_YAML_PINHOLECAMERAMODEL_IO_HPP
3 #define LVR2_IO_YAML_PINHOLECAMERAMODEL_IO_HPP
7 #include <yaml-cpp/yaml.h>
33 node[
"camera_model"] =
"pinhole";
35 node[
"resolution"] = Load(
"[]");
40 pinholeNode[
"cx"] = scanCam.
camera.
cx;
41 pinholeNode[
"cy"] = scanCam.
camera.
cy;
42 pinholeNode[
"fx"] = scanCam.
camera.
fx;
43 pinholeNode[
"fy"] = scanCam.
camera.
fy;
44 node[
"pinhole"] = pinholeNode;
49 for(
size_t i = 0; i < scanCam.
camera.
k.size(); i++)
53 distortion[s.str()] = scanCam.
camera.
k[i];
55 node[
"distortion"] = distortion;
74 if(node[
"sensor_name"])
76 scanCam.
sensorName = node[
"sensor_name"].as<std::string>();
83 if(node[
"resolution"] && node[
"resolution"].size() == 2)
85 scanCam.
camera.
width = node[
"resolution"][0].as<
unsigned>();
86 scanCam.
camera.
height = node[
"resolution"][1].as<
unsigned>();
89 std::string camera_model = node[
"camera_model"].as<std::string>();
91 if(camera_model ==
"pinhole")
94 Node pinholeNode = node[
"pinhole"];
95 scanCam.
camera.
cx = pinholeNode[
"cx"].as<
double>();
96 scanCam.
camera.
cy = pinholeNode[
"cy"].as<
double>();
97 scanCam.
camera.
fx = pinholeNode[
"fx"].as<
double>();
98 scanCam.
camera.
fy = pinholeNode[
"fy"].as<
double>();
100 std::cout <<
"Camera model unknown" << std::endl;
109 Node distortionNode = node[
"distortion"];
113 for(
size_t i = 0; i < distortionNode.size(); i++)
115 std::cout << i << std::endl;
116 scanCam.
camera.
k.push_back(distortionNode[i].as<double>());
120 std::cout <<
"Distortion model unknown" << std::endl;
133 #endif // LVR2_IO_YAML_PINHOLECAMERAMODEL_IO_HPP