Calculate real-time signal frequency - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Calculate real-time signal frequency

Posts: 2Member
Hello everyone.

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.