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
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "libvideostitch/config.hpp"
#include "libvideostitch/quaternion.hpp"
#include "gpu/vectorTypes.hpp"
#include <map>
#include <vector>
namespace VideoStitch {
namespace Motion {
namespace ImageSpace {
struct MotionVector {
MotionVector() {
from.x = 0;
from.y = 0;
to.x = 0;
to.y = 0;
}
MotionVector(float2 from, float2 to) : from(from), to(to) {}
inline float magnitude2() const {
float diffX = to.x - from.x;
float diffY = to.y - from.y;
return (diffX * diffX) + (diffY * diffY);
}
float2 from;
float2 to;
};
typedef std::vector<MotionVector> MotionVectorField;
typedef std::map<int64_t, MotionVectorField> MotionVectorFieldTimeSeries;
} // namespace ImageSpace
namespace SphericalSpace {
struct MotionVector {
MotionVector(const Quaternion<double>& from, const Quaternion<double>& to) : from(from), to(to) {}
Quaternion<double> from;
Quaternion<double> to;
};
typedef std::vector<MotionVector> MotionVectorField;
typedef std::map<int64_t, MotionVectorField> MotionVectorFieldTimeSeries;
} // namespace SphericalSpace
} // namespace Motion
} // namespace VideoStitch