Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Calculate real-time signal frequency
I'm trying to program the following scenario:
I want to be monitoring with a camera a spot of a grayscale image that is going to be changing its intensity with a certain frequency (around 1 Hz, but I need to be as accurate as possible). I will probably acquire de images through labview, but i can embed analysis matlab code in it. So I'd like to be receiving real-time data (images = pixels) and analysing them with matlab in order to know the frequency. The intensity of the maximums is going to be decreasing with every cycle. The signal could last about 10 seconds . It is likely that the signal will have some noise due to the surrounding pixels, although in general they have a smaller intensity compared to the targeted spot.
I've thought of 2 ways to implement it, but i need your advice.
1. Calculate the mean of the pixels of each image (there is no restrictions with the number of frames per second since the camera can record up to 340fps) and see when it's changing from ascending to descending and vice-versa and see the time difference between maximums. (I imagine it could be done by seeing when the derivative is equal to zero). This way I could plot the intensities and the time so see the signal.
2. Use fft to estimate the frequency. I don't know if this is possible in real-time nor if it could be used when the maximums are changing.
Can you give me any insight?
English is not my mother tongue so if you didn't understand something just ask. Thanks.