08-03-2017 01:25 PM
I have a Logitech C920 webcam that I wish to control via LabVIEW. I want to be able to trigger the acquisition of frames from within a VI, acquire 1080p resolution images at 30fps, generate a timestamp for each frame and then save each as a PNG. I knocked up the attached VI based upon some butchering of the 'Grab and Basic Attributes' example that ships with the Vision toolkit, and I've translated it into a producer/consumer wherein the first loop is used to handle the acquisition and the second the saving task, which essentially works.
However, the issue I get is that when the enqueue operation is included the framerate drops to about 11-13fps and frames are missed. If I disable the enqueue operation then the framerate jumps back to the expected 30fps, however I'm obviously then not able to save the acquired images. It's obviously not an easy task to troubleshoot in the absence of the specific hardware, but If anyone has any advice, or is able to explain this behaviour then that would be much appreciated!
Owen
08-03-2017 03:57 PM
Hi,
I don't have a chance to look at your code, but enqueing images in queues is generally tricky to get right in LabVIEW because images are reference types, not values. You have to be very careful with how you manage them to ensure you aren't re-using the same reference where you don't intend to.
IMAQdx has a new type of acquisition called a Ring that makes this type of design much easier to do. It is also significantly more efficient as data is never copied. Look at the "Low-Level Ring Parallel Workers.vi" example included in IMAQdx to see how to use it (just remove all but one worker loop). The idea is that you extract the image, queue it, then your worker loop dequeues it, processes it, and then releases the buffer back to IMAQdx. This removes all the above-mentioned buffer management from your code and leaves it to IMAQdx.
08-03-2017 10:32 PM
unfortunately this is one of labview vision toolkit problem many camera encounter with this problem even you use producer/consumer nothing change also if you use vision acquisition assistance in higher version 2015 and above there is waring text in save page that annonce you this frame reduction will be happen
some method that fix this problem but not exactly what you want
use video recording with appropriate compression method
for wait next buffer in grab use false boolean
add image to front of que
and at the end i should indicate that these method just hide this problem and still this problem exist