Mercurial Hosting > traffic-intelligence
comparison c/Motion.cpp @ 490:60735bd452fc
merged
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 11 Apr 2014 17:47:55 -0400 |
parents | 46b5cb3f3114 |
children | f86f5f25730a |
comparison
equal
deleted
inserted
replaced
489:000bddf84ad0 | 490:60735bd452fc |
---|---|
167 int firstInstant = static_cast<int>(MAX(ft->getFirstInstant(), ft2->getFirstInstant())); | 167 int firstInstant = static_cast<int>(MAX(ft->getFirstInstant(), ft2->getFirstInstant())); |
168 if (lastInstant-firstInstant > static_cast<int>(minFeatureTime)) { // equivalent to lastInstant-firstInstant+1 >= minFeatureTime | 168 if (lastInstant-firstInstant > static_cast<int>(minFeatureTime)) { // equivalent to lastInstant-firstInstant+1 >= minFeatureTime |
169 if (ft->minMaxSimilarity(*ft2, firstInstant, lastInstant, connectionDistance, segmentationDistance)) { | 169 if (ft->minMaxSimilarity(*ft2, firstInstant, lastInstant, connectionDistance, segmentationDistance)) { |
170 UndirectedGraph::edge_descriptor e; | 170 UndirectedGraph::edge_descriptor e; |
171 bool unused; | 171 bool unused; |
172 tie(e, unused) = add_edge(newVertex, *vi, graph); | 172 boost::tuples::tie(e, unused) = add_edge(newVertex, *vi, graph); |
173 // no need to add measures to graph[e] (edge properties) | 173 // no need to add measures to graph[e] (edge properties) |
174 } | 174 } |
175 } | 175 } |
176 } | 176 } |
177 } | 177 } |
188 | 188 |
189 vector<unsigned int> lastInstants(num, 0); // last instant of component with id | 189 vector<unsigned int> lastInstants(num, 0); // last instant of component with id |
190 vector<vector<vertex_descriptor> > tmpobjects(num), objects; // vector of components (component = vector of vertex descriptors) | 190 vector<vector<vertex_descriptor> > tmpobjects(num), objects; // vector of components (component = vector of vertex descriptors) |
191 | 191 |
192 graph_traits<UndirectedGraph>::vertex_iterator vi, vend; | 192 graph_traits<UndirectedGraph>::vertex_iterator vi, vend; |
193 for(tie(vi,vend) = vertices(graph); vi != vend; ++vi) { | 193 for(boost::tuples::tie(vi,vend) = vertices(graph); vi != vend; ++vi) { |
194 unsigned int id = components[*vi]; | 194 unsigned int id = components[*vi]; |
195 lastInstants[id] = max(lastInstants[id], graph[*vi].feature->getLastInstant()); | 195 lastInstants[id] = max(lastInstants[id], graph[*vi].feature->getLastInstant()); |
196 tmpobjects[id].push_back(*vi); | 196 tmpobjects[id].push_back(*vi); |
197 } | 197 } |
198 | 198 |
247 int FeatureGraph::getNEdges(void) const { return num_edges(graph);} | 247 int FeatureGraph::getNEdges(void) const { return num_edges(graph);} |
248 | 248 |
249 void FeatureGraph::computeVertexIndex(void) { | 249 void FeatureGraph::computeVertexIndex(void) { |
250 graph_traits<FeatureGraph::UndirectedGraph>::vertex_iterator vi, vend; | 250 graph_traits<FeatureGraph::UndirectedGraph>::vertex_iterator vi, vend; |
251 graph_traits<FeatureGraph::UndirectedGraph>::vertices_size_type cnt = 0; | 251 graph_traits<FeatureGraph::UndirectedGraph>::vertices_size_type cnt = 0; |
252 for(tie(vi,vend) = vertices(graph); vi != vend; ++vi) | 252 for(boost::tuples::tie(vi,vend) = vertices(graph); vi != vend; ++vi) |
253 graph[*vi].index = cnt++; | 253 graph[*vi].index = cnt++; |
254 } | 254 } |