Objective-C Peak Detection Accelerate Framework

2019-04-15 00:32发布

I am a no math guru here, so I want to ask anyone familiar with Digital Signal Processing, what is the best way of detecting real time peaks. I get about 30 frames/values a second and I've tried to implement the slope algorithm for detecting peaks, it worked OK, about 80% of the cases, but its really not good enough :(.

From what I've searched one should use the Fast Fourier Transform, but I have no idea how to get started with it, perhaps I'm missing the general idea of how I should use FFT in this case.

In iOS we have this amazing Accelerate framework that should help me do the FFT stuff but as long as I dont get the general idea its pretty much useless to me.

Can anyone enlighten me somehow by pointing me in the right direction :-) ?

Thanks a lot, and Happy New Year !

1条回答
等我变得足够好
2楼-- · 2019-04-15 01:22

So you have a float array of camera light values generated every second that contains 30 samples. You want to know what is the peak value per second? Or ever? To calculate the maximum value in a vector using accelerate you can use the vDSP_maxv function.

Or are you trying to detect all of the peaks above a given threshold per second? In that case you can generate a vector containing the threshold value that is the same length as the vector to search peaks. Then you can use the vDSP_vmax function to find all values above this threshold.

If this is not good enough, there are many more sophisticated techniques for finding peaks in time series, some simple ones are discussed here:

Peak Detection in Time Series

I would probably try something like calculating the gradient and looking for 0 crossings with vDSP_nzcros.

查看更多
登录 后发表回答