-
Notifications
You must be signed in to change notification settings - Fork 0
/
BufferFFT.h
53 lines (37 loc) · 998 Bytes
/
BufferFFT.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
#ifndef _BUFFER_FFT
#define _BUFFER_FFT
#define _USE_MATH_DEFINES
#include <math.h>
#include <opencv2\opencv.hpp>
#include "BandProcess.h"
#include <time.h>
#include "windows.h"
#include <deque>
class BufferFFT
{
public:
BufferFFT(int n = 322, float spikeLimit = 5.0);
void GetFFT();
float FindOffset();
void Reset();
void Execute(float data_in);
float ready;
int size;
int n_;
float fps;
Mat fft;
std::vector<float> freqs;
std::deque<time_t> times;
std::deque<float> samples;
std::vector<float> interpolated;
private:
void Interpolate(const std::vector<double> &newTimes, const std::deque<time_t> &original, const std::deque<float> &samples );
std::vector<float> HammingWindow(int length);
std::vector<float> HighPass(std::vector<float> &samples);
std::vector<float> SubtractMean(std::vector<float> &samples);
float spike_limit;
std::vector<double> even_times;
bool offset_strategy_remove_all = true;
bool remove_all_when_full = false;
};
#endif