24 #ifndef ROBDEKON_DENSECRFFEATURETERMS_H
25 #define ROBDEKON_DENSECRFFEATURETERMS_H
27 #include <pcl/pcl_macros.h>
37 template <
class GraphT>
40 typedef typename GraphT::vertex_descriptor
VertexId;
53 const int N = boost::num_vertices(
_graph);
57 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
58 features(0, i) = xyz[0] / exp(sigma[0]);
59 features(1, i) = xyz[1] / exp(sigma[1]);
60 features(2, i) = xyz[2] / exp(sigma[2]);
66 template <
class GraphT>
69 typedef typename GraphT::vertex_descriptor
VertexId;
82 const int N = boost::num_vertices(
_graph);
86 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
87 features(0, i) =
isfinite(normal[0]) ? normal[0] / exp(sigma[0]) : 0;
88 features(1, i) =
isfinite(normal[1]) ? normal[1] / exp(sigma[1]) : 0;
89 features(2, i) =
isfinite(normal[2]) ? normal[2] / exp(sigma[2]) : 0;
95 template <
class GraphT>
98 typedef typename GraphT::vertex_descriptor
VertexId;
107 const Eigen::MatrixXf
111 const int N = boost::num_vertices(
_graph);
115 float curv = std::fabs(
_graph[i].curvature);
117 features(0, i) = curv / exp(sigma[0]);
123 template <
class GraphT>
126 typedef typename GraphT::vertex_descriptor
VertexId;
135 const Eigen::MatrixXf
139 const int N = boost::num_vertices(
_graph);
143 Eigen::Vector3f rgb =
_graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
144 features(0, i) = rgb[0] / exp(sigma[0]);
145 features(1, i) = rgb[1] / exp(sigma[1]);
146 features(2, i) = rgb[2] / exp(sigma[2]);
152 template <
class GraphT>
155 typedef typename GraphT::vertex_descriptor
VertexId;
164 const Eigen::MatrixXf
168 const int N = boost::num_vertices(
_graph);
173 Eigen::Vector3f rgb =
_graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
174 features(0, i) = rgb[0] / exp(sigma[0]);
175 features(1, i) = rgb[1] / exp(sigma[1]);
176 features(2, i) = rgb[2] / exp(sigma[2]);
178 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
179 features(3, i) =
std::isfinite(normal[0]) ? normal[0] / exp(sigma[3]) : 0.0;
180 features(4, i) =
std::isfinite(normal[1]) ? normal[1] / exp(sigma[4]) : 0.0;
181 features(5, i) =
std::isfinite(normal[2]) ? normal[2] / exp(sigma[5]) : 0.0;
183 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
184 features(6, i) = xyz[0] / exp(sigma[6]);
185 features(7, i) = xyz[1] / exp(sigma[7]);
186 features(8, i) = xyz[2] / exp(sigma[8]);
189 float curv =
_graph[i].curvature;
190 features(9, i) =
std::isfinite(curv) ? curv / exp(sigma[9]) : 0.0;
192 features(10, i) = time[i] / exp(sigma[10]);
198 template <
class GraphT>
201 typedef typename GraphT::vertex_descriptor
VertexId;
226 const int N = boost::num_vertices(
_graph);
234 Eigen::Vector3f rgb =
235 _graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
236 features(j, i) = rgb[0] / exp(sigma[j]);
237 features(j + 1, i) = rgb[1] / exp(sigma[j + 1]);
238 features(j + 2, i) = rgb[2] / exp(sigma[j + 2]);
244 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
245 features(j, i) =
std::isfinite(normal[0]) ? normal[0] / exp(sigma[j]) : 0.0;
247 std::isfinite(normal[1]) ? normal[1] / exp(sigma[j + 1]) : 0.0;
249 std::isfinite(normal[2]) ? normal[2] / exp(sigma[j + 2]) : 0.0;
255 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
256 features(j, i) = xyz[0] / exp(sigma[j]);
257 features(j + 1, i) = xyz[1] / exp(sigma[j + 1]);
258 features(j + 2, i) = xyz[2] / exp(sigma[j + 2]);
265 float curv =
_graph[i].curvature;
266 features(j, i) =
std::isfinite(curv) ? curv / exp(sigma[j]) : 0.0;
272 features(j, i) = time[i] / exp(sigma[j]);
282 long unsigned int _num_feat = 0;
283 _num_feat +=
useRGB ? 3 : 0;
285 _num_feat +=
useXYZ ? 3 : 0;
292 template <
class GraphT>
295 typedef typename GraphT::vertex_descriptor
VertexId;
320 const int N = boost::num_vertices(
_graph);
324 meanAndStd = calculateMeanAndStd(
_graph);
325 ARMARX_DEBUG <<
"Mean of Input Values: " << meanAndStd.col(0)
326 <<
"\n Standard Deviation of Input Values: " << meanAndStd.col(1);
332 Eigen::Vector3f rgb =
333 _graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
336 ((rgb[0] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
339 ((rgb[1] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
342 ((rgb[2] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
347 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
351 ? ((normal[0] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j])
356 ? ((normal[1] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j])
361 ? ((normal[2] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j])
367 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
370 ((xyz[0] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
373 ((xyz[1] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
376 ((xyz[2] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
382 float curv =
_graph[i].curvature;
386 ? ((curv - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j])
394 ((time[i] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
402 calculateMeanAndStd(GraphT& graph)
415 meanAndStd.setZero();
427 Eigen::Vector3f rgb =
428 _graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
437 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
446 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
456 float curv =
_graph[i].curvature;
465 Eigen::VectorXd meanNext = meanAndStd.col(0) + (x - meanAndStd.col(0)) /
double(k);
466 meanAndStd.col(1) += (x - meanAndStd.col(0)).cwiseProduct(x - meanNext);
467 meanAndStd.col(0) = meanNext;
470 meanAndStd.col(1) = (meanAndStd.col(1) / double(k - 1)).cwiseSqrt().array() + 1e-8;
477 long unsigned int _num_feat = 0;
478 _num_feat +=
useRGB ? 3 : 0;
480 _num_feat +=
useXYZ ? 3 : 0;
489 typedef typename GraphWithTimestamp::vertex_descriptor
VertexId;
498 const Eigen::MatrixXf
502 const int N = boost::num_vertices(
_graph);
507 features(0, i) = (time[i]) / exp(sigma[0]);
513 #endif //ROBDEKON_DENSECRFFEATURETERMS_H