annotate include/utils.hpp @ 70:a52653dca25d

got track features to compile, updated paths to headers and libraries for OpenCV 2
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 13 Nov 2010 11:20:10 -0500
parents ef0d7caf8e91
children b32947b002da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
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
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
20 inline double square(const int& a) { return a*a;}
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
21
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
22 /** Implements key bindings, for example for cvWaitKey(). */
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
23 inline bool forwardKey(const int& pressedKey) { return (((char)pressedKey) == '+');}
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
24
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
25 inline bool backwardKey(const int& pressedKey) { return (((char)pressedKey) == '-');}
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
26
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
27 inline bool saveKey(const int& pressedKey) { return (((char)pressedKey) == 's' || ((char)pressedKey) == 'S');}
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
28
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
29 inline bool interruptionKey(const int& pressedKey) { return (((char)pressedKey) == 'q' || ((char)pressedKey) == 'Q');}
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
30
ff5403319cec optical flow demo working
Nicolas Saunier <nico@confins.net>
parents: 3
diff changeset
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