Mercurial Hosting > traffic-intelligence
annotate include/Motion.hpp @ 684:6d2ece4aed7c dev
bug forgot to svae objects
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 05 Jun 2015 13:26:51 +0200 |
parents | 045d05cef9d0 |
children | 17e54690af8a 8ac7f61c6e4f |
rev | line source |
---|---|
177
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
1 #ifndef MOTION_HPP |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
2 #define MOTION_HPP |
119
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
3 |
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
4 #include "src/Trajectory.h" |
163
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
5 #include <boost/graph/adjacency_list.hpp> |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
6 |
399
c389fae9689a
Added a class to read list of image instead of video. This is controlled by the use of the database-filename and folder-data parameters in the config file.
Jean-Philippe Jodoin <jpjodoin@gmail.com>
parents:
391
diff
changeset
|
7 |
133
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
8 template<typename T> class TrajectoryDBAccess; |
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
9 |
654
045d05cef9d0
updating to c++11 capabilities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
481
diff
changeset
|
10 typedef std::shared_ptr<TrajectoryPoint2f> TrajectoryPoint2fPtr; |
176
9323427aa0a3
changed positions and velocities to shared pointers and renamed methods
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
165
diff
changeset
|
11 |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
12 /** Class for feature data |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
13 positions, velocities and other statistics to evaluate their quality |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
14 before saving. */ |
399
c389fae9689a
Added a class to read list of image instead of video. This is controlled by the use of the database-filename and folder-data parameters in the config file.
Jean-Philippe Jodoin <jpjodoin@gmail.com>
parents:
391
diff
changeset
|
15 class FeatureTrajectory |
c389fae9689a
Added a class to read list of image instead of video. This is controlled by the use of the database-filename and folder-data parameters in the config file.
Jean-Philippe Jodoin <jpjodoin@gmail.com>
parents:
391
diff
changeset
|
16 { |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
17 public: |
200
0a27fa343257
added one test and cleaned the first and last instant mess
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
196
diff
changeset
|
18 FeatureTrajectory(const unsigned int& frameNum, const cv::Point2f& p, const cv::Mat& homography); |
129
4742b2b6d851
created basic feature saving code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
19 |
177
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
20 FeatureTrajectory(TrajectoryPoint2fPtr& _positions, TrajectoryPoint2fPtr& _velocities); |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
21 |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
22 /** loads from database |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
23 can be made generic for different list and blob */ |
654
045d05cef9d0
updating to c++11 capabilities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
481
diff
changeset
|
24 FeatureTrajectory(const int& id, TrajectoryDBAccess<cv::Point2f>& trajectoryDB, const std::string& positionsTableName, const std::string& velocitiesTableName); |
177
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
25 |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
26 unsigned int length(void) const { return positions->size();} // cautious if not continuous: max-min+1 |
134
a617d0808bbc
added test on feature length and display control
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
133
diff
changeset
|
27 |
191
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
28 unsigned int getId(void) const { return positions->getId();} |
176
9323427aa0a3
changed positions and velocities to shared pointers and renamed methods
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
165
diff
changeset
|
29 void setId(const unsigned int& id) { positions->setId(id);velocities->setId(id);} |
133
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
30 |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
31 unsigned int getFirstInstant(void) {return firstInstant;} |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
32 unsigned int getLastInstant(void) {return lastInstant;} |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
33 |
186
6c48283a78ca
work on feature similarity, issue with getting point
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
180
diff
changeset
|
34 //TrajectoryPoint2fPtr& getPositions(void) { return positions;} |
6c48283a78ca
work on feature similarity, issue with getting point
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
180
diff
changeset
|
35 //TrajectoryPoint2fPtr& getVelocities(void) { return velocities;} |
6c48283a78ca
work on feature similarity, issue with getting point
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
180
diff
changeset
|
36 |
138
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
37 /// indicates whether the sum of the last nDisplacements displacements has been inferior to minFeatureDisplacement |
176
9323427aa0a3
changed positions and velocities to shared pointers and renamed methods
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
165
diff
changeset
|
38 bool isDisplacementSmall(const unsigned int& nDisplacements, const float& minTotalFeatureDisplacement) const; |
135
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
39 |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
40 /// indicates whether the last two displacements are smooth (limited acceleration and angle) |
176
9323427aa0a3
changed positions and velocities to shared pointers and renamed methods
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
165
diff
changeset
|
41 bool isMotionSmooth(const int& accelerationBound, const int& deviationBound) const; |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
42 |
186
6c48283a78ca
work on feature similarity, issue with getting point
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
180
diff
changeset
|
43 /// computes the distance according to the Beymer et al. algorithm |
192
38974d27dd2d
connected_components is working with listS for vertex list
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
191
diff
changeset
|
44 bool minMaxSimilarity(const FeatureTrajectory& ft, const int& firstInstant, const int& lastInstant, const float& connectionDistance, const float& segmentationDistance); |
186
6c48283a78ca
work on feature similarity, issue with getting point
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
180
diff
changeset
|
45 |
200
0a27fa343257
added one test and cleaned the first and last instant mess
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
196
diff
changeset
|
46 void addPoint(const unsigned int& frameNum, const cv::Point2f& p, const cv::Mat& homography); |
119
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
47 |
138
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
48 void shorten(void); |
c1b260b48d2a
corrected initialization bugs and feature shortening before saving
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
136
diff
changeset
|
49 |
481
b6ad86ee7033
implemented smoothing (requires latest trajectory management library version)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
399
diff
changeset
|
50 void movingAverage(const unsigned int& nFramesSmoothing); |
b6ad86ee7033
implemented smoothing (requires latest trajectory management library version)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
399
diff
changeset
|
51 |
165
50964af05a80
solved issue with header inclusion
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
163
diff
changeset
|
52 void write(TrajectoryDBAccess<cv::Point2f>& trajectoryDB, const std::string& positionsTableName, const std::string& velocitiesTableName) const; |
133
63dd4355b6d1
saving of feature positions in sqlite database
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
132
diff
changeset
|
53 |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
54 #ifdef USE_OPENCV |
147
0089fb29cd26
added projection of points and reprojection for display
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
142
diff
changeset
|
55 void draw(cv::Mat& img, const cv::Mat& homography, const cv::Scalar& color) const; |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
56 #endif |
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
57 |
362
cc8e54997d4c
corrected error in tests and changed sstream to ostream for FeatureTrajectory operator<<
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
231
diff
changeset
|
58 friend std::ostream& operator<<(std::ostream& out, const FeatureTrajectory& ft); |
177
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
59 |
119
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
60 protected: |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
61 /// first frame number |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
62 unsigned int firstInstant; |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
63 /// last frame number |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
64 unsigned int lastInstant; |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
65 |
176
9323427aa0a3
changed positions and velocities to shared pointers and renamed methods
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
165
diff
changeset
|
66 TrajectoryPoint2fPtr positions; |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
67 /** one fewer velocity than position |
362
cc8e54997d4c
corrected error in tests and changed sstream to ostream for FeatureTrajectory operator<<
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
231
diff
changeset
|
68 v_n = p_n - p_n-1*/ |
176
9323427aa0a3
changed positions and velocities to shared pointers and renamed methods
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
165
diff
changeset
|
69 TrajectoryPoint2fPtr velocities; |
129
4742b2b6d851
created basic feature saving code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
70 |
139
47329bd16cc0
cleaned code, added condition on smooth displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
138
diff
changeset
|
71 /// norms of velocities for feature constraints, one fewer positions than positions |
129
4742b2b6d851
created basic feature saving code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
72 std::vector<float> displacementDistances; |
4742b2b6d851
created basic feature saving code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
73 |
4742b2b6d851
created basic feature saving code
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
119
diff
changeset
|
74 void computeMotionData(const int& frameNum); |
119
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
75 }; |
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
76 |
654
045d05cef9d0
updating to c++11 capabilities
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
481
diff
changeset
|
77 typedef std::shared_ptr<FeatureTrajectory> FeatureTrajectoryPtr; |
132
45c64e68053c
added drawing function for features
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
129
diff
changeset
|
78 |
177
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
79 // inlined |
399
c389fae9689a
Added a class to read list of image instead of video. This is controlled by the use of the database-filename and folder-data parameters in the config file.
Jean-Philippe Jodoin <jpjodoin@gmail.com>
parents:
391
diff
changeset
|
80 inline std::ostream& operator<<(std::ostream& out, const FeatureTrajectory& ft) |
c389fae9689a
Added a class to read list of image instead of video. This is controlled by the use of the database-filename and folder-data parameters in the config file.
Jean-Philippe Jodoin <jpjodoin@gmail.com>
parents:
391
diff
changeset
|
81 { |
177
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
82 out << *(ft.positions); |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
83 out << "\n"; |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
84 out << *(ft.velocities); |
399
c389fae9689a
Added a class to read list of image instead of video. This is controlled by the use of the database-filename and folder-data parameters in the config file.
Jean-Philippe Jodoin <jpjodoin@gmail.com>
parents:
391
diff
changeset
|
85 |
177
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
86 return out; |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
87 } |
ae2286b1a3fd
added loading FeatureTrajectory from database, printing
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
176
diff
changeset
|
88 |
135
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
89 // class MovingObject {} |
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
90 // roadUserType, group of features |
32d2722d4028
added constraint on minimum displacement
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
134
diff
changeset
|
91 |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
92 /** Class to group features: Beymer et al. 99/Saunier and Sayed 06 |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
93 \todo create various graph types with different parameters, that accept different feature distances or ways to connect and segment features */ |
163
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
94 class FeatureGraph { |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
95 protected: |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
96 struct FeatureConnection { |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
97 float minDistance; |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
98 float maxDistance; |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
99 }; |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
100 |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
101 struct VertexInformation { |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
102 FeatureTrajectoryPtr feature; |
192
38974d27dd2d
connected_components is working with listS for vertex list
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
191
diff
changeset
|
103 int index; |
163
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
104 }; |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
105 |
192
38974d27dd2d
connected_components is working with listS for vertex list
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
191
diff
changeset
|
106 typedef boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, VertexInformation, FeatureConnection> UndirectedGraph; |
163
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
107 |
191
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
108 public: |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
109 typedef UndirectedGraph::vertex_descriptor vertex_descriptor; |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
110 |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
111 FeatureGraph(float _connectionDistance, float _segmentationDistance, unsigned int _minFeatureTime, float _minNFeaturesPerGroup) : connectionDistance (_connectionDistance), segmentationDistance(_segmentationDistance), minFeatureTime(_minFeatureTime), minNFeaturesPerGroup(_minNFeaturesPerGroup) {} |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
112 |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
113 void addFeature(const FeatureTrajectoryPtr& ft); |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
114 |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
115 // add vertex, includes adding links to current vertices |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
116 // find connected components, check if old enough, if so, remove |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
117 |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
118 /// Computes the connected components: features have to be older than lastInstant |
221
bc93e87a2108
cleaned and corrected connected components and feature groups
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
201
diff
changeset
|
119 void connectedComponents(const unsigned int& lastInstant); |
191
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
120 |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
121 /** Performs some checks on groups of features and return their lists of ids if correct |
201
f7ddfc4aeb1e
added tests for graphs
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
200
diff
changeset
|
122 Removes the vertices from the graph */ |
391
03dbecd3a887
modified feature grouping to return vectors of pointers to feature trajectories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
362
diff
changeset
|
123 void getFeatureGroups(std::vector<std::vector<FeatureTrajectoryPtr> >& featureGroups); |
191
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
124 |
196
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
194
diff
changeset
|
125 std::string informationString(void) const; |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
194
diff
changeset
|
126 |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
194
diff
changeset
|
127 int getNVertices(void) const; |
aeab0b88c9b6
began testing of FeatureGraph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
194
diff
changeset
|
128 int getNEdges(void) const; |
191
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
129 |
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
130 protected: |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
131 float connectionDistance; |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
132 float segmentationDistance; |
180
3a4eef37384f
method to add features and vertices to graph
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
179
diff
changeset
|
133 unsigned int minFeatureTime; |
191
0e60a306d324
added basic code to identify features and save them (crash)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
190
diff
changeset
|
134 float minNFeaturesPerGroup; |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
135 // float minDistance; |
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
136 // float maxDistance; |
163
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
137 |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
138 UndirectedGraph graph; |
192
38974d27dd2d
connected_components is working with listS for vertex list
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
191
diff
changeset
|
139 |
194
09c7881073f3
connected commponents works, but issue with removing the vertices
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
192
diff
changeset
|
140 std::vector<std::vector<vertex_descriptor> > objectHypotheses; |
09c7881073f3
connected commponents works, but issue with removing the vertices
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
192
diff
changeset
|
141 |
192
38974d27dd2d
connected_components is working with listS for vertex list
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
191
diff
changeset
|
142 void computeVertexIndex(void); |
163
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
143 |
179
4f10e97cb677
added getting first and last instant for each feature
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
178
diff
changeset
|
144 //std::vector<UndirectedGraph::vertex_descriptor> currentVertices, lostVertices; |
163
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
145 }; |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
146 |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
147 // inlined implementations |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
148 // inline FeatureGraph::FeatureGraph(float _minDistance, float _maxDistance) |
cde87a07eb58
added graph structures
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
147
diff
changeset
|
149 |
119
45a426552aaa
compilation of very simple feature class with trajectory
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
150 #endif |