-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfvml_type.h
69 lines (55 loc) · 1.61 KB
/
sfvml_type.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef SFVML_TYPE
#define SFVML_TYPE
// opencv
#include "opencv2/opencv.hpp"
// std
#include <ostream>
namespace Sfvml {
// FIXME should be unsigned
struct Position {
Position(double x_, double y_) : x(x_), y(y_) {}
Position() = default;
bool operator==(const Position& rhs) const {
// TODO need for epsilon comp ?
return (x == rhs.x && y == rhs.y);
}
bool operator!=(const Position& rhs) const {
return !(*this == rhs);
}
double x;
double y;
};
inline std::ostream& operator<<(std::ostream& os, const Position& pos) {
os << "x:" << pos.x << ", y:" << pos.y;
return os;
}
// When cropping a new ROI, select a direction for the
// update wrt. previous position
enum Direction
{
k_IDENT = 0,
k_RIGHT = 1,
k_LEFT = 2,
k_UP = 4,
k_DOWN = 8,
// Combinations
k_UPLEFT = 6,
k_UPRIGHT = 5,
k_DOWNRIGHT = 9,
k_DOWNLEFT = 10
};
inline std::ostream& operator<<(std::ostream& os, const Direction& direction)
{
os << (direction == Direction::k_IDENT ? "Identical" :
direction == Direction::k_RIGHT ? "Right" :
direction == Direction::k_LEFT ? "Left" :
direction == Direction::k_UP ? "Up" :
direction == Direction::k_DOWN ? "Down" :
direction == Direction::k_UPLEFT ? "UpLeft" :
direction == Direction::k_UPRIGHT ? "UpRight" :
direction == Direction::k_DOWNRIGHT ? "DownRight" :
"DownLeft" );
return os;
}
} // Sfvml::
#endif