arntanguy / gram_savitzky_golay

C++ Implementation of Savitzky-Golay filtering based on Gram polynomials
BSD 2-Clause "Simplified" License
100 stars 29 forks source link

How to convert from old version #9

Open redxtech opened 3 years ago

redxtech commented 3 years ago

Hey, I'm working on updating a project that used your older version of this (https://github.com/arntanguy/sgsmooth), and I'm wanting to switch it over to use this version instead. However, I've found that I have no clue how I'm supposed to get the same outcome I used to get by using this library.

Here's what I used to have:

vector<double> data = {...}; // ~900 items
int window_size = 91;
int degree = 3;

for (int i = 0; i < filter_passes; i++) {
    data = sgsmooth(data, window_size, degree);
}
// data is now smoothed

I initially was going to use filter.filter(data), but then I found out that returned a double instead of a vector<double>, and I'm not sure what to do with that.

Any help would be appreciated, especially since I'm not too familiar with the actual math behind the smoothing.