0
$\begingroup$

Goal: I have a video stream from a webcam. I need get frequency of the green color changes on the video.

Video color space is RGB The signal looks sinusoidal with a frequency range 0.5 - 2.4 Hz

I performed the following steps:

  1. Capture Video frames into collection.
  2. Processing frames by Gaussian pyramid down level 4. (frame size now is ~ 37x32)
  3. use DFT/FFT with sample rate 30
  4. get spectrum
  5. calculate frequency

on DFT I put data from each frame: video frames quantity = 60

Method 1: I collect green channel from frame and join with the green channel from a next frame, in result I have a big data array.

37*32=1184

1184*60=71040 the size of the sample buffer

one long array with 71040 data point of all pixels in the green channel of each frame. (all green pixels from one frame + from next frame)

Method 2: I collect the green channel from an each pixel on the frame and join with the same green channel pixel from a next frame, as a result I have a big data array.

1184 arrays with 60 data points (each green pixel from one frame + from next frame)

Which method is the correct one?

$\endgroup$

1 Answer 1

0
$\begingroup$

If you need to track changes in time, then the most natural and obvious way is to form one temporal (green data) vector per pixel that you want to observe, then take its DFT (it's way 2, but with more than 2 frames).

The actual vector length and DFT function that you should use will depend on the actual case you are working on.

  • Suppose you work from a recorder video. Then, you can take the 1D DFT of the vector formed with the value of one pixel of interest in the whole sequence.
  • On the other hand, if you work from a live feed, then you need to use a FIFO data vector and probably apply a windowed 1D Fourier transform to avoid artifacts, see short-time Fourier transform.
$\endgroup$
5
  • $\begingroup$ yes, I need track changes over time, but I take not all pixels from frame, but only one from the frame center - to detect changes, and then I capture this pixel data with FPS 30 - (5 sec * FPS = 150 data point) - it's right? or I need capture more than one pixel over time for DFT? $\endgroup$
    – 452
    Commented Oct 7, 2013 at 8:42
  • $\begingroup$ FPS 21.2 FPS 16.5 FPS 21.9 FPS 26.5 FPS 28.9 FPS 29.6 FPS 29.8 FPS 29.5 FPS 29.4 FPS 29.5 - I have, it's very critical? $\endgroup$
    – 452
    Commented Oct 7, 2013 at 11:51
  • $\begingroup$ Two solutions here: either you go with the data you have and assume that the sampling is regular in time, or you want to be accurate but then you need to implement some FFT with irregularly spread data. I doubt that your application does not require that kind of accuracy though. $\endgroup$
    – sansuiso
    Commented Oct 7, 2013 at 19:19
  • $\begingroup$ how about 2D and 3D DFT for this case can be used?, I use jtransforms - java, and this library support 1D 2D 3D 4D FFT. Can I use 3D FFT for a filter/mask frequency on the images over time? $\endgroup$
    – 452
    Commented Oct 18, 2013 at 9:53
  • $\begingroup$ Yes, you can. But it's not what you are trying to do from the question. $\endgroup$
    – sansuiso
    Commented Oct 18, 2013 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.