* use SSF signal instead of accelerometer signal
* use higher BEAT_CORR_THR_{12} for SSF signal
* add absolute SSF_THRESHOLD to ignore small accelero bumps
* compute ssf_threshold according to detected SSF peaks, not the mean (more robust vs. noise)
42 lines
1.5 KiB
C++
42 lines
1.5 KiB
C++
//
|
|
// Created by david on 04.03.2026.
|
|
//
|
|
|
|
#ifndef PASADASUPERPROJECT_SIGNAL_H
|
|
#define PASADASUPERPROJECT_SIGNAL_H
|
|
|
|
#include <vector>
|
|
#include <deque>
|
|
|
|
namespace pd_signal {
|
|
/** `num` evenly spaced numbers over interval [start,stop] */
|
|
void linspace(std::vector<double>& data, double start, double stop, int num);
|
|
/** `num` evenly spaced numbers over interval [start,stop] with endpoint=true or [start,stop) with endpoint=false */
|
|
void linspace(std::vector<double>& data, double start, double stop, int num, bool endpoint);
|
|
|
|
/**
|
|
* Evaluate at points x the function given by the samples fp[xp[n]].
|
|
* Returned in y.
|
|
*/
|
|
void interp(std::vector<double>& y, std::vector<double>& x, std::vector<double>& xp, std::vector<double>& fp);
|
|
|
|
/** resample to BEAT_LEN */
|
|
void resample(std::vector<double> &out, std::vector<double> &x, int beat_len);
|
|
|
|
/**
|
|
* normalized cross-correlation of the two signals of same length.
|
|
* normalization factor is <c>1 / sqrt(\sum_i x_i^2 * \sum_i y_i^2)</c>
|
|
*/
|
|
double crossCorr(std::vector<double> &x, std::vector<double> &y);
|
|
|
|
/** clip 'val' to between 'a_min' and 'a_max'. */
|
|
double clip(double val, double a_min, double a_max);
|
|
|
|
/** two-dimensional mean of a collection of signals */
|
|
void mean(std::vector<double> &out, std::vector<std::vector<double> >& m);
|
|
/** two-dimensional mean of a collection of signals */
|
|
void mean(std::vector<double> &out, std::deque<std::vector<double> >& m);
|
|
|
|
}
|
|
|
|
#endif //PASADASUPERPROJECT_SIGNAL_H
|