From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 2.0 camera has lag through Imaqdx

Hi Everybody!

 

This is my first post so I hope I'm doing this right... 

 

I have a USB 2.0 camera that I'm viewing by Imaqdx.

The issue I'm having is that there seems to be a lag in the aquisition of about 4-6 frames. 

When aquiring at 30fps this is not such an issue, but at the max resolution (which I need) max fps is 2, so its 2-3 seconds delay.

 

As I'm using the camera to allow the user to find a location using a joystick, a 2 or 3 second delay in feedback is terrible to work with.

 

When I view the camera through the vendors software (at max resolution) it is much faster, so it seems to be possible, the camera can do it. 

Frame rate as measured by Labview is the set 2fps, the current frame is just 3 seconds old.

I can see the camera in NI Max, but in Devices it is not shown as an NI Vision device but as a normal camera. 

 

I've added screenshots of NI MAX, device manager (in dutch...) and the most simple program I tried. 

Camera is a Dino Lite Premier AD7013MT and I'm using Labview 2013 with IMAQdx 14.0

 

Let me know if there you have some idea of what I could try to speed things up.

 

Thanks in advance,

 

Michiel Stevens

 

Simple VI.pngNI MAX.pngDevice manager.png

 

 

0 Kudos
Message 1 of 8
(4,555 Views)

The problem might be USB speed, particularly as it seems to work except at "high resolution".  Try it in MAX -- open the camera as it shows in MAX, configure it (in MAX) for the resolution and frame speed you want, then do a Grab -- do the images look OK?  If so, you should be able to do the same thing using IMAQdx.

 

Bob Schor

0 Kudos
Message 2 of 8
(4,541 Views)

Hey Bob,

 

Thanks for the quick reply!

 

I've done what you suggested, and the images look okay, but also in MAX the delay is present.

In the vendor software this does not happen, so I'm not sure how it could be USB speed as there both using the USB connection.

What is seems to me is that some sort of buffer is filled with unprocessed images with a max of 5 or 6. At high frame rates the delay then stays low enough not be noticable.

 

 What I noticed however in MAX that I had not seen before is that the delay builds up. So the first few seconds its 'live', after about 10 seconds the delay has build up to more than a second.

In Imaqdx this also happens.

To me this does not make much sense, but maybe to you it does?

 

Regards,

Michiel

 

 

0 Kudos
Message 3 of 8
(4,531 Views)

Can you attach the VI?  The picture of it is too small for me to see, and I have too many other things to do to manually recreate your code.  If there are important sub-VIs we should have, put everything together in a Folder and attach the Compressed Folder (a Zip file).

 

BS

0 Kudos
Message 4 of 8
(4,506 Views)

In the vendor software this does not happen, so I'm not sure how it could be USB speed as there both using the USB connection.

What is seems to me is that some sort of buffer is filled with unprocessed images with a max of 5 or 6. At high frame rates the delay then stays low enough not be noticable.

 

 What I noticed however in MAX that I had not seen before is that the delay builds up. So the first few seconds its 'live', after about 10 seconds the delay has build up to more than a second.

In Imaqdx this also happens.

To me this does not make much sense, but maybe to you it does?

 

 


.

The IMAQdx driver software for USB 2.0 indicates that Micrsoft's DirectShow is used.

 

http://digital.ni.com/public.nsf/allkb/0564022DAFF513D2862579490057D42E

 

Maybe the vendor's native software bypasses DirectShow?

 

Since IMAQdx with USB 2.0 seems to require DirectShow, I would contact the vendor to be sure you are running the best possible DirectShow driver from them.

 

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 5 of 8
(4,496 Views)

Hmm.  I've got a Logitech Webcam C920 plugged into a USB2 port (I think)(yes, I plugged it in again to a port I know is USB2).  I've just gone into MAX and asked for 1920x1080 RGB24 30fps Grab (I'm not trying to save to disk), and it seems to have no trouble showing me everything (there's a barely-perceptible lag, which seems the same at the default low resolution).

 

If you are trying to acquire, view, and save all in the same loop, it will take additional time as you need to take the Acquire time + Show time + Write time into account.  Use parallel loops (Producer/Consumer Design Pattern) and you should be able to keep up.  You might consider displaying every other frame (as that may be the slowest step).

 

Bob Schor

0 Kudos
Message 6 of 8
(4,480 Views)

Hey all,

 

Sorry that its been so long for me to get back to this. I've had some other projects that took up my intention.

Thank you all for the suggestions, I've not been able to look into all yet but have maybe made some progress...

 

I've had another look at this and are still not sure why I'm seeing the lag, but do have part of a solution.

What I've done is use the ActiveX component to open and view the camera. This leads to a live image with (almost) no lag and good frame rates.

 

However what I'm not able to do is go from a VB element (the live preview window) to an image that I can process (IMAQ).

Anybody got an idea of how I can do that? (and I'd rather not save and load...)

 

Regards,

Michiel

 

 

0 Kudos
Message 7 of 8
(4,260 Views)

You still have not provided your code (meaning the actual VI(s), not tiny pictures of the Block Diagram, which I can neither see nor test).  Also I notice from one of your screen shots that you have so NI Vision hardware, which I assume you are not using, correct?

 

Let us take a look at (and potentially test) your VI and we may be able to help you.  I can certainly say I'm able to acquire images with an inexpensive USB 2.0 camera at 30 fps with negligible delay (most of which, I suspect, is the delay in rendering the image).

 

Bob Schor

0 Kudos
Message 8 of 8
(4,246 Views)