Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronized capture for multiple USB cameras

I need to capture images from 8 USB cameras at the same time.  I don't need to continuously acquire images (just one set every few seconds), but I need the 8 cameras to capture at very close to the same exact time.  Just testing with two cameras at the moment, and one camera always seems to capture about 0.4 seconds after the other.  Attached is the current VI I'm testing with.

 

Any idea how to speed this up?  I thought having both grab.vi's in a separate frame would help make them occur at the same time, but it's still a lot slower than I hoped for.  Thanks for any suggestions.

0 Kudos
Message 1 of 8
(10,831 Views)

Well, I just tried putting the Configure Grab VI's in the first frame and set the "wait for next buffer" to False.  I'm now down to about 0.1 second difference between the two cameras.  That's quite a bit better, but it still may not be fast enough for me, as demanding as that sounds....

0 Kudos
Message 2 of 8
(10,829 Views)

All depends from precision. 100 ms is not bad result. For better precision I would like to suggest to use cams with external triggers. The cameras with USB interface are also available, for example:

 

http://www.thorlabs.de/newgrouppage9.cfm?objectgroup_id=2916

http://www.edmundoptics.com/products/displayproduct.cfm?productid=3356

http://www.ptgrey.com/news/pressreleases/details.asp?articleID=230

 

Otherwise they may be incompatible with IMAQdx (the only DirectShow compliant cameras are supported). Point Gray Chameleon seems to be DirectShow compatible.

0 Kudos
Message 3 of 8
(10,826 Views)

Thanks for the reply.  Unfortunately, for this project I really can't afford any of these specialized cameras.  The cameras I'm planning on using (have 1 right now) are the Microsoft HD-5000 webcams, at $25 a pop.

 

What's strange to me is that I can capture video at 30 fps from both cameras, at the same time.  So I would think that I'd be able to get two cameras synchronized to within 1/30th of a second.  If I could actually capture video from 8 cameras at 30 fps, I'd just do that, but unfortunately I can only do that with 3 cameras at most.

0 Kudos
Message 4 of 8
(10,819 Views)

Your code has the start of the acquisition in the same frame as the grab. This means that one camera could be still starting while you get an image from the second. Additionally, you are using the high-level grab and not specifying which frame you want, so you may get different frame numbers from each camera even if they started at the same time.

 

Here's a suggestion:

-Move the start to the first frame, then change your Grab call to always return the newest image, rather than next (this ensures it doesn't block and so all of them in parallel run at the same time).

 

Eric

0 Kudos
Message 5 of 8
(10,814 Views)

Hello,

First, as your cameras are running at 30fps and are not hardware triggered,  the best you can get is 1/30s between two consecutive frames.

Then I suppose your cameras are RGB VGA, so the throughput is about 6480*480*3*30=26MB/s (unless the video is compressed)

And an USB 2.0 offers 60MB/S so be carrefull not to plug all your camera on the same port.

Regards

NTA_LabView_certified_Developper.jpg
0 Kudos
Message 6 of 8
(10,806 Views)

BlueCheese, when you say "change Grab to always return newest image," is that achieved by setting "wait for next buffer" to false?  Or is there a different Grab vi that I should be using?  

0 Kudos
Message 7 of 8
(10,799 Views)

murrdpirate, is it possible to get me a screenshot of this vi? Even better save in the previous version for 8.2? 

 

I am trying to get 4 cameras up and running but couldn't succeed so far. 

 

Thanks,

Emre

0 Kudos
Message 8 of 8
(9,890 Views)