24 #ifndef ROBDEKON_DENSECRFFEATURETERMS_H
25 #define ROBDEKON_DENSECRFFEATURETERMS_H
28 #include <pcl/pcl_macros.h>
35 template<
class GraphT>
38 typedef typename GraphT::vertex_descriptor
VertexId;
48 const int N = boost::num_vertices(
_graph);
52 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
53 features(0, i) = xyz[0] / exp(sigma[0]);
54 features(1, i) = xyz[1] / exp(sigma[1]);
55 features(2, i) = xyz[2] / exp(sigma[2]);
61 template<
class GraphT>
64 typedef typename GraphT::vertex_descriptor
VertexId;
74 const int N = boost::num_vertices(
_graph);
78 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
79 features(0, i) =
isfinite(normal[0]) ? normal[0] / exp(sigma[0]) : 0;
80 features(1, i) =
isfinite(normal[1]) ? normal[1] / exp(sigma[1]) : 0;
81 features(2, i) =
isfinite(normal[2]) ? normal[2] / exp(sigma[2]) : 0;
87 template<
class GraphT>
90 typedef typename GraphT::vertex_descriptor
VertexId;
100 const int N = boost::num_vertices(
_graph);
104 float curv = std::fabs(
_graph[i].curvature);;
105 features(0, i) = curv / exp(sigma[0]);
111 template<
class GraphT>
114 typedef typename GraphT::vertex_descriptor
VertexId;
124 const int N = boost::num_vertices(
_graph);
128 Eigen::Vector3f rgb =
_graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
129 features(0, i) = rgb[0] / exp(sigma[0]);
130 features(1, i) = rgb[1] / exp(sigma[1]);
131 features(2, i) = rgb[2] / exp(sigma[2]);
137 template<
class GraphT>
140 typedef typename GraphT::vertex_descriptor
VertexId;
150 const int N = boost::num_vertices(
_graph);
155 Eigen::Vector3f rgb =
_graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
156 features(0, i) = rgb[0] / exp(sigma[0]);
157 features(1, i) = rgb[1] / exp(sigma[1]);
158 features(2, i) = rgb[2] / exp(sigma[2]);
160 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
161 features(3, i) =
std::isfinite(normal[0]) ? normal[0] / exp(sigma[3]) : 0.0;
162 features(4, i) =
std::isfinite(normal[1]) ? normal[1] / exp(sigma[4]) : 0.0;
163 features(5, i) =
std::isfinite(normal[2]) ? normal[2] / exp(sigma[5]) : 0.0;
165 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
166 features(6, i) = xyz[0] / exp(sigma[6]);
167 features(7, i) = xyz[1] / exp(sigma[7]);
168 features(8, i) = xyz[2] / exp(sigma[8]);
171 float curv =
_graph[i].curvature;
172 features(9, i) =
std::isfinite(curv) ? curv / exp(sigma[9]) : 0.0;
174 features(10, i) = time[i] / exp(sigma[10]);
180 template<
class GraphT>
183 typedef typename GraphT::vertex_descriptor
VertexId;
196 const int N = boost::num_vertices(
_graph);
204 Eigen::Vector3f rgb =
_graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
205 features(j, i) = rgb[0] / exp(sigma[j]);
206 features(j + 1, i) = rgb[1] / exp(sigma[j + 1]);
207 features(j + 2, i) = rgb[2] / exp(sigma[j + 2]);
213 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
214 features(j, i) =
std::isfinite(normal[0]) ? normal[0] / exp(sigma[j]) : 0.0;
215 features(j + 1, i) =
std::isfinite(normal[1]) ? normal[1] / exp(sigma[j + 1]) : 0.0;
216 features(j + 2, i) =
std::isfinite(normal[2]) ? normal[2] / exp(sigma[j + 2]) : 0.0;
222 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
223 features(j, i) = xyz[0] / exp(sigma[j]);
224 features(j + 1, i) = xyz[1] / exp(sigma[j + 1]);
225 features(j + 2, i) = xyz[2] / exp(sigma[j + 2]);
232 float curv =
_graph[i].curvature;
233 features(j, i) =
std::isfinite(curv) ? curv / exp(sigma[j]) : 0.0;
239 features(j, i) = time[i] / exp(sigma[j]);
248 long unsigned int calcNumFeatues()
250 long unsigned int _num_feat = 0;
251 _num_feat +=
useRGB ? 3 : 0;
253 _num_feat +=
useXYZ ? 3 : 0;
260 template<
class GraphT>
263 typedef typename GraphT::vertex_descriptor
VertexId;
278 const int N = boost::num_vertices(
_graph);
282 meanAndStd = calculateMeanAndStd(
_graph);
283 ARMARX_DEBUG <<
"Mean of Input Values: " << meanAndStd.col(0) <<
"\n Standard Deviation of Input Values: "
284 << meanAndStd.col(1);
290 Eigen::Vector3f rgb =
_graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
292 features(j, i) = ((rgb[0] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
294 features(j, i) = ((rgb[1] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
296 features(j, i) = ((rgb[2] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
301 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
303 features(j, i) =
std::isfinite(normal[0]) ? ((normal[0] - meanAndStd(j, 0)) / meanAndStd(j, 1)) /
306 features(j, i) =
std::isfinite(normal[1]) ? ((normal[1] - meanAndStd(j, 0)) / meanAndStd(j, 1)) /
309 features(j, i) =
std::isfinite(normal[2]) ? ((normal[2] - meanAndStd(j, 0)) / meanAndStd(j, 1)) /
315 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
317 features(j, i) = ((xyz[0] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
319 features(j, i) = ((xyz[1] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
321 features(j, i) = ((xyz[2] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
327 float curv =
_graph[i].curvature;
329 features(j, i) =
std::isfinite(curv) ? ((curv - meanAndStd(j, 0)) / meanAndStd(j, 1)) /
336 features(j, i) = ((time[i] - meanAndStd(j, 0)) / meanAndStd(j, 1)) / exp(sigma[j]);
346 Eigen::MatrixXd calculateMeanAndStd(GraphT& graph)
359 meanAndStd.setZero();
371 Eigen::Vector3f rgb =
_graph[i].getBGRVector3cMap().template cast<float>() / 255.0f;
380 Eigen::Vector3f normal =
_graph[i].getNormalVector3fMap();
389 Eigen::Vector3f xyz =
_graph[i].getVector3fMap();
399 float curv =
_graph[i].curvature;
408 Eigen::VectorXd meanNext = meanAndStd.col(0) + (x - meanAndStd.col(0)) /
double(k);
409 meanAndStd.col(1) += (x - meanAndStd.col(0)).cwiseProduct(x - meanNext);
410 meanAndStd.col(0) = meanNext;
414 meanAndStd.col(1) = (meanAndStd.col(1) / double(k - 1)).cwiseSqrt().array() + 1e-8;
418 long unsigned int calcNumFeatues()
420 long unsigned int _num_feat = 0;
421 _num_feat +=
useRGB ? 3 : 0;
423 _num_feat +=
useXYZ ? 3 : 0;
432 typedef typename GraphWithTimestamp::vertex_descriptor
VertexId;
442 const int N = boost::num_vertices(
_graph);
447 features(0, i) = (time[i]) / exp(sigma[0]);
453 #endif //ROBDEKON_DENSECRFFEATURETERMS_H