view include/utils.hpp @ 12:ff5403319cec

optical flow demo working
author Nicolas Saunier <nico@confins.net>
date Wed, 11 Nov 2009 23:25:23 -0500
parents ace29ecfb846
children ef0d7caf8e91
line wrap: on
line source

#ifndef UTILS_HPP
#define UTILS_HPP

static const double pi = 3.14159265358979323846;

inline double square(const int& a) { return a*a;}

/** Implements key bindings, for example for cvWaitKey(). */
inline bool forwardKey(const int& pressedKey) { return (((char)pressedKey) == '+');}

inline bool backwardKey(const int& pressedKey) { return (((char)pressedKey) == '-');}

inline bool saveKey(const int& pressedKey) { return (((char)pressedKey) == 's' || ((char)pressedKey) == 'S');}

inline bool interruptionKey(const int& pressedKey) { return (((char)pressedKey) == 'q' || ((char)pressedKey) == 'Q');}

inline bool skipKey(const int& pressedKey) { return (((char)pressedKey) == 'n' || ((char)pressedKey) == 'N');}

#endif