-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmoother.hpp
30 lines (24 loc) · 876 Bytes
/
smoother.hpp
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
#pragma once
#include "imgproc.hpp"
#include <vector>
#include <cmath>
#include <algorithm>
#include <deque>
class L1SmootherCenter
{
public:
L1SmootherCenter(int lagBehind, int lagAhead, double lambda = 1.0);
/**
* Push a new measurement (for frame index = current total input - 1).
* Returns an optional "finalized" transform if any frame is ready.
* If none is ready, returns an identity transform and sets a flag.
*/
bool update(const SimilarityTransform& meas,
SimilarityTransform& outFinalized);
private:
int m_lagBehind; ///< how many past frames to include
int m_lagAhead; ///< how many future frames
double m_lambda; ///< smoothing strength
int m_nextToFinalize; ///< index of the next measurement to finalize
std::vector<SimilarityTransform> m_measurements;
};