comparison c/Motion.cpp @ 188:1435965d8181

work on connected components
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 01 Dec 2011 19:18:32 -0500
parents aa1061fb9695
children 1116f0a1ff31
comparison
equal deleted inserted replaced
187:aa1061fb9695 188:1435965d8181
1 #include "Motion.hpp" 1 #include "Motion.hpp"
2 #include "cvutils.hpp" 2 #include "cvutils.hpp"
3
4 #include "src/TrajectoryDBAccessList.h"
3 5
4 #include "opencv2/core/core.hpp" 6 #include "opencv2/core/core.hpp"
5 #include "opencv2/highgui/highgui.hpp" 7 #include "opencv2/highgui/highgui.hpp"
6 8
7 #include "src/TrajectoryDBAccessList.h" 9 #include <boost/graph/connected_components.hpp>
10 #include <boost/config.hpp>
11
12 #include <iostream>
13 #include <vector>
14 #include <algorithm>
15 #include <utility>
8 16
9 using namespace std; 17 using namespace std;
10 using namespace cv; 18 using namespace cv;
11 19
12 /******************** FeatureTrajectory ********************/ 20 /******************** FeatureTrajectory ********************/
155 } 163 }
156 } 164 }
157 } 165 }
158 } 166 }
159 167
168 void FeatureGraph::connectedComponents(const int& lastInstant) {
169 vector<int> component(num_vertices(graph));
170 // int num = connected_components(graph, &component[0]);
171 // todo change the type of the component map http://www.boost.org/doc/libs/1_48_0/libs/graph/doc/connected_components.html
172
173 // cout << "Total number of components: " << num << endl;
174
175 for (unsigned int i = 0; i < component.size(); ++i)
176 cout << "Vertex " << i <<" is in component " << component[i] << endl;
177 cout << endl;
178 }
179
160 string FeatureGraph::informationString(void) { 180 string FeatureGraph::informationString(void) {
161 stringstream ss; 181 stringstream ss;
162 ss << num_vertices(graph) << " vertices, " << num_edges(graph) << " edges"; 182 ss << num_vertices(graph) << " vertices, " << num_edges(graph) << " edges";
163 return ss.str(); 183 return ss.str();
164 } 184 }