18 #ifndef _DS3D_DATALOADER_DEPTHSOURCE_CONFIG_H
19 #define _DS3D_DATALOADER_DEPTHSOURCE_CONFIG_H
21 #include <ds3d/common/common.h>
22 #include <ds3d/common/func_utils.h>
24 #include "ds3d/common/hpp/yaml_config.hpp"
26 namespace ds3d {
namespace impl {
namespace depthsource {
58 "parse depthsource component content failed");
61 if (node[
"depth_source"]) {
62 config.
depthSource = node[
"depth_source"].as<std::string>();
65 if (node[
"color_source"]) {
66 config.
colorSource = node[
"color_source"].as<std::string>();
72 "depth_source and color_source, at least of them must be configured");
74 if (node[
"depth_scale"]) {
75 config.
depthScale = node[
"depth_scale"].as<
double>();
78 if (node[
"depth_datatype"]) {
79 auto type = node[
"depth_datatype"].as<std::string>();
81 type ==
"uint16" || type ==
"int16",
ErrCode::kConfig,
"depth_datatype must be uint16");
85 auto color = node[
"color"].as<std::string>();
88 if (node[
"depth_size"]) {
89 auto size = node[
"depth_size"].as<std::vector<uint32_t>>();
97 if (node[
"color_size"]) {
98 auto size = node[
"color_size"].as<std::vector<uint32_t>>();
108 intrinsic.width = n[
"width"].as<uint32_t>();
109 intrinsic.height = n[
"height"].as<uint32_t>();
110 intrinsic.centerX = n[
"centerX"].as<
float>();
111 intrinsic.centerY = n[
"centerY"].as<
float>();
112 intrinsic.fx = n[
"fx"].as<
float>();
113 intrinsic.fy = n[
"fy"].as<
float>();
116 if (node[
"depth_intrinsic"]) {
120 if (node[
"color_intrinsic"]) {
125 if (node[
"depth_to_color_extrinsic"]) {
126 auto yExt = node[
"depth_to_color_extrinsic"];
127 auto r = yExt[
"rotation"].as<std::vector<float>>();
130 "depth_to_color_extrinsic.rotation must be specified as 9 float values");
134 auto tr = yExt[
"translation"].as<std::vector<float>>();
137 "depth_to_color_extrinsic.translation must be specified as 3 float values");
145 #endif // _DS3D_DATALOADER_DEPTHSOURCE_CONFIG_H