Objective-C Peak Detection Accelerate Framework

十年热恋 提交于 2020-01-01 19:57:34

问题


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:


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.



来源:https://stackoverflow.com/questions/14125995/objective-c-peak-detection-accelerate-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!