LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine the time between two consecutive frames ?

Solved!
Go to solution

Hi,

I am trying to find out how to determine the time between two consecutive frames in a video. I have gone through the following posts and have followed the vi discussed in the post for calculating the time stamps of images acquired by my camera (Basler ace acA1300-30gm) :

https://forums.ni.com/t5/Machine-Vision/Timestamping-of-images-in-NI-IMAQdx/td-p/445132?query.id=116...

https://forums.ni.com/t5/Machine-Vision/How-to-determine-the-accuracy-of-the-frame-rate-using-a-Basl...

 

Now, I want to calculate the time between two consecutive frames in a video (.avi file) or the time between two consecutive images in Grab.vi/continous acquisition(any 1/both preferably). I understood how to calculate the timestamps but I am not getting how to calculate the time between frames.

 

Any suggestions will be appreciated.

Download All
0 Kudos
Message 1 of 7
(5,269 Views)

I'm not certain how you use metadata to get a Date/Time String, but assuming you have it, you can use the functions in the Time Palette to generate a TimeStamp.  If you subtract two TimeStamps, you get the time difference (as a Dbl) in seconds, which should give you the timing information you want.

 

Bob Schor

0 Kudos
Message 2 of 7
(5,214 Views)

I sometimes noticed some strange behavior when substracting two timestamp values and converting them to double afterwards....so what I Usually do is convert both values to doubles and substract them afterwards. 

Does this work for you with the meta data?

Niko NR
Systems Engineer, National Instruments
0 Kudos
Message 3 of 7
(5,198 Views)

In my Basler camera,I get the metadata for timestamps(low and high bytes separately). Date/time string which I have used is secondary(not important.I was just trying something out). What I would like to know is how I can find the time between two consecutive frames because when I run the VI it is in a Loop for which  the timestamps run on continously. What I am looking forward to is how to take two consecutive frames from a video file and then find the time difference between them.

0 Kudos
Message 4 of 7
(5,190 Views)

A different question: when you use the grab.vi with your Basler camera with say 30fps, this should be rather accurate in terms that you can determine from:

(start time) + (number of frames)*(1/30fps) = actual time

Since the acquisition is hardware timed from your camera this should be reliable and bring the same result and from my experience with camera vendors this is often the way the meta data is written in first place.

Niko NR
Systems Engineer, National Instruments
0 Kudos
Message 5 of 7
(5,180 Views)

Yes, true. But, what I am looking is how to find the time difference between two frames in .avi file for eg. I suppose for that to work  I should :

  1. Extract frames from avi file

  2. Find the timestamps for those particular frames

  3. Calculate the difference between the timestamps.

Any Information will be helpful related to it.

0 Kudos
Message 6 of 7
(5,174 Views)
Solution
Accepted by topic author enthusiast4

Four years ago, I responded to a similar question here by noting that if you are using LabVIEW to write the AVI file, you might have difficulty writing a TimeStamp on each frame, and gave some work-arounds.  It turns out that the original "Write AVI with metadata" functions might still be available (but hidden).  However, as noted earlier, the camera has the "accurate clock" for acquiring the frames, and assuming your LabVIEW code can keep up with the camera, the time-between-frames should be stable (and known) by being the reciprocal of Frames/second.

 

Bob Schor

Message 7 of 7
(5,162 Views)