C++实现峰值检测,可根据阈值、峰值距离筛选峰值
等同于matlab findpeak函数
头文件如下
#ifndef __FINDPEAKS__
#define __FINDPEAKS__
#include
struct peak
{
int index;
float value;
};
bool comparePeaks(const peak& a, const peak& b);
bool compareIndex(const peak& a, const peak& b);
std::vectorfindPeaks(const std::vector& src, int distance = 0, float threshold = 0);
#endif
1