07-02-2007 06:57 PM
07-03-2007 05:37 PM
06-25-2012 03:23 PM
Hi,
I am trying to develop a VI that will acquire video from a usb 2 webcam. The camera is used via directshow. I am using IMAQdx VI's. I would like to save the videos in AVI files. I tried the code at the beginning saving 3-5 seconds of videos. The camera is set up to sample video at 30 FPS.
I would like to check what is the actual frame rate. How can I do that? I need to synch the videos with some analog data and I was to make sure the videos are sampled properly.
Also, when I increased the duration of the videos to 30 s. the saving time increased tremendeously. Is there a way that I can save chuncks of video periodically without losing any frame?
Can anyone please advise?
Thank you, Massimo.
06-26-2012 03:11 PM
Hi Massimo,
You could use a producer consumer architecture to acquire and save your images. This will acquire images in one loop and save the images in another loop, eliminating the worry about the time to save to an AVI file. Please check out the example below, I believe it may help.
NI-Vision Image Processing with Producer/Consumer Loops
http://zone.ni.com/devzone/cda/epd/p/id/5859
Tim O
06-27-2012 10:29 AM
Hi Tim,
thank you! That code is very cool. I have seen something similar elsewhere, in another post but some people have argued about the queing approach, which in the solution you suggested to me is used much more effectively. It runs fine but in my application I need to ensure consistent frame rate and any solution I came across so far doesn't guarantee that. I have an idea that I need to try out and test. I have tried so many version that I think I have a good grasp (at least I think) of what are the pros and cons of the different solutions I have tried. I really like the way the saving as AVI is implemented in the solution you sent me and I will definitely steal it and put it in my final version.
If it is not to much to ask, I will post my tentative final solution so that maybe you can see what I did to ensure constant frame rate.
I will post something very soon.
Thank you again,
best, Massi.
06-28-2012 11:47 AM
Hi Massi,
To ensure exact frame rates from a camera you would need to use triggering. DirectShow (the USB driver) does not support triggering; you would have to uses a different interface to ensure exact timing. I am not saying you cannot achieve a steady frame rate, I am just letting you know your timing will ultimate be dependent by Windows and the DirectShow driver.
Choosing the Right Camera Bus
http://www.ni.com/white-paper/5386/en
Tim O
07-12-2012 05:08 AM
Hi everyone,
I've got the same problem.
I am using a code based on LL Grab example, and even if I set a frame rate for the camera with an external trigger, the indicator reutrns values which are always smaller than the one I set.
So I would like to ask you two questions:
1) how can I estimate the actual frae rate at which the camera is acquiring images
2) do you have any particular advice to enforce a frame rate?
Thank you for your time. If you solved the problem, you might already have these answers.
Regards,
Emanuele
07-12-2012 05:45 AM
Hello,
Did you checked that the exposure time of your camera is lower than the trigger interval.
By selecting a shorter exposure time, your camera will be able to reach higher fps. But depending on the camera specs, you are limited by the physical fps of your camera.
Then, for some cameras you can find with a property node some parameters that allows you to set constant frame rate CFR.
Regards
07-12-2012 10:20 AM
Yes I checked it, my exposure time is about 33ms whereas my set frame rate is 100ms, therefore it should work, but if I for example grab images using the VI example HL grab, I don't get the requested frame rate! Why is it so? Is it because the frame rate computation inisde HL grab is based on a time stamp software? How can I check it otherwise?
07-12-2012 10:20 AM
I have used as the fram rate the value which is reported on the indicator in HL grab