12 namespace mrpt {
namespace srba {
15 template <
class KF2KF_POSE_TYPE,
class LM_TYPE,
class OBS_TYPE,
class RBA_OPTIONS>
17 const std::string &targetFileName,
18 const bool all_landmarks
23 std::ofstream f(targetFileName.c_str());
24 if (!f.is_open())
return false;
28 if (!rba_state.keyframes.empty())
31 f <<
"/* KEYFRAMES */\n"
32 "node [shape=box,style=filled];\n";
34 for (
size_t id=0;
id<rba_state.keyframes.size();++id)
39 f <<
"/* KEYFRAME->KEYFRAME edges */\n"
40 "edge [style=bold];\n";
41 #ifdef SRBA_WORKAROUND_MSVC9_DEQUE_BUG
44 const k2k_edge_t * itEdge = itEdge2->pointer();
49 f << itEdge->
from <<
"->" << itEdge->
to <<
";\n";
55 f <<
"/* LANDMARKS with known relative position, and its base keyframe */\n"
56 "node [shape=triangle,style=filled,fillcolor=gray80];\n"
57 "edge [style=bold,color=black];\n";
59 f << itLM->second.id_frame_base <<
" -> " <<
"L"<<itLM->first <<
"; ";
63 f <<
"/* LANDMARKS with unknown relative position */\n"
64 "node [shape=triangle,style=filled,fillcolor=white];\n"
65 "edge [style=solid,color=gray20];\n";
67 f << itLM->second.id_frame_base <<
" -> " <<
"L"<<itLM->first <<
"; ";
71 f <<
"/* OBSERVATIONS */\n"
72 "edge [style=dotted,color=black];\n";
77 #ifdef SRBA_WORKAROUND_MSVC9_DEQUE_BUG
78 f << (*itO)->obs.kf_id <<
" -> L" << (*itO)->obs.obs.feat_id <<
";\n";
80 f << itO->obs.kf_id <<
" -> L" << itO->obs.obs.feat_id <<
";\n";
const Scalar * const_iterator
Keyframe-to-keyframe edge: an unknown of the problem.
bool save_graph_as_dot(const std::string &targetFileName, const bool all_landmarks=false) const
Exports all the keyframes (and optionally all landmarks) as a directed graph in DOT (graphviz) format...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.