Mercurial Hosting > traffic-intelligence
annotate include/utils.hpp @ 140:8de5e8256224
added function to save vectors of features
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 23 Aug 2011 19:04:41 -0400 |
parents | a52653dca25d |
children | b32947b002da |
rev | line source |
---|---|
3
ace29ecfb846
basic files and directories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
1 #ifndef UTILS_HPP |
ace29ecfb846
basic files and directories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
2 #define UTILS_HPP |
ace29ecfb846
basic files and directories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
3 |
70
a52653dca25d
got track features to compile, updated paths to headers and libraries for OpenCV 2
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
20
diff
changeset
|
4 #include <iosfwd> |
20
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
5 |
12 | 6 static const double pi = 3.14159265358979323846; |
3
ace29ecfb846
basic files and directories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
7 |
20
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
8 /** Opens file for writing with fixed scientific precision. */ |
70
a52653dca25d
got track features to compile, updated paths to headers and libraries for OpenCV 2
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
20
diff
changeset
|
9 void openWriteScientificPrecision(std::ofstream& out, const std::string& filename, const int& precision); |
20
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
10 |
70
a52653dca25d
got track features to compile, updated paths to headers and libraries for OpenCV 2
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
20
diff
changeset
|
11 void openWritePrecision(std::ofstream& out, const std::string& filename, const int& precision); |
20
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
12 |
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
13 /** Opens files and checks how it went. */ |
70
a52653dca25d
got track features to compile, updated paths to headers and libraries for OpenCV 2
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
20
diff
changeset
|
14 bool openCheck(std::ifstream& f, const std::string& filename, const std::string& callingFunctionName); |
a52653dca25d
got track features to compile, updated paths to headers and libraries for OpenCV 2
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
20
diff
changeset
|
15 bool openCheck(std::ofstream& f, const std::string& filename, const std::string& callingFunctionName); |
20
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
16 |
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
17 |
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
18 // inline |
ef0d7caf8e91
draft code for feature saving (UBC format)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
12
diff
changeset
|
19 |
12 | 20 inline double square(const int& a) { return a*a;} |
21 | |
22 /** Implements key bindings, for example for cvWaitKey(). */ | |
23 inline bool forwardKey(const int& pressedKey) { return (((char)pressedKey) == '+');} | |
24 | |
25 inline bool backwardKey(const int& pressedKey) { return (((char)pressedKey) == '-');} | |
26 | |
27 inline bool saveKey(const int& pressedKey) { return (((char)pressedKey) == 's' || ((char)pressedKey) == 'S');} | |
28 | |
29 inline bool interruptionKey(const int& pressedKey) { return (((char)pressedKey) == 'q' || ((char)pressedKey) == 'Q');} | |
30 | |
31 inline bool skipKey(const int& pressedKey) { return (((char)pressedKey) == 'n' || ((char)pressedKey) == 'N');} | |
3
ace29ecfb846
basic files and directories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
32 |
ace29ecfb846
basic files and directories
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
33 #endif |