LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple USB Webcam control using IMAQ

Hi everyone,

 

I know this question has been posted here several times but I couldnt find one solid solution to it.

 

I am trying to acquire images from 3 different usb cameras using IMAQ along with the vision software. My purpose isBUT  NOT to simultaneously display all three continuous images at once on the screen BUT instead I want the user to have the option to shift from one image to the other while the program is running. At one time there should be only one continuous image displayed on the screen.

 

I got one USB camera working using the example provided in LabVIEW>>Examples>>IMAQ USB [Note: the example that features the ability to capture both video as well as an image]. The issue with that VI is that though the Enumerate.vi within the program lists all the cameras hooked up, it only allows the first camera to operate. I have to manually change the "index" of the index array in order to switch between cameras and then rerun the program again.

 

Is it possible to switch between different cameras and display their repective images while the program is running using some sort of a menu or similar feature ?

 

I am using the latest versions of all softwares involved.

 

Cheers,

 

Sandeep 

Message 1 of 13
(5,760 Views)

the USB for Webcam interface has this limitation that you can only acquire from one webcam at any time. But you can always close the webcam session and open a new one whenever the user selects a different camera in the user interface. Just use an even structure to detect the new camera selection and then close the previous camera and open the new one with the index your user selected.

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 13
(5,738 Views)

Hi Rolf,

 

Thanks for responding to my query. 

 

By closing the webcam session do you mean that I exit from the VI, then change webcams and re-start the program ?

 

Can you please elaborate on the technique you mentioned, I want to try using it and get my stuff working.

 

Thanks,

0 Kudos
Message 3 of 13
(5,728 Views)

Sandeep_k wrote:

Hi Rolf,

 

Thanks for responding to my query. 

 

By closing the webcam session do you mean that I exit from the VI, then change webcams and re-start the program ?

 

Can you please elaborate on the technique you mentioned, I want to try using it and get my stuff working.

 

Thanks,


No you have an IMAQ USB Init.vi which you use to open the camera and then you can acquire your images and display them and when you do not need that camera anymore you use the IMAQ USB Close.vi. And after that you can execute an IMAQ USB Init.vi for another camera.

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 13
(5,723 Views)

Thanks Rolf. Let me give it a try and if that works for me I ll post the VI as a solution.

 

 

0 Kudos
Message 5 of 13
(5,716 Views)

Hello,

 

We are the IGVC design team at Johns Hopkins University. We are somehow stuck because we dont' have a IMAQ USB.ctl file to run our camera VIs. What should we do?

 

 

Thanks,

Nathan

0 Kudos
Message 6 of 13
(4,462 Views)

Hello nathanlin,

 

What VI are you running when you labview prompts you that it can't find the control?  Have you tried repairing Labview or the IMAQ drivers?  

 

David A.

0 Kudos
Message 7 of 13
(4,432 Views)

Regarding multiple webcam control, is anyone having an issue with trying to identify which webcam is where?  For example, we have four lanes in a machine that we have to capture images for, so we must know which images are from which lane.  We find through successive boots of the PC that the webcams are not always the same (cam0 is not always the same cam0, cam1 is not always the same cam1, etc).  We tried tracking each by polling serial numbers, but incredibly the serial numbers reported by Windows changes from webcam to webcam.  Has anyone encountered this and have a solution?

Thanks in advance...

0 Kudos
Message 8 of 13
(4,394 Views)

Hello Rick J.,

 

Are you using a USB hub to connect the cameras to the computer?  Also, can you elaborate on the the serial numbers changing from webcam to webcam?  They should all have different serial numbers, but those numbers should remain the same after every restart.  Does that mean the four cameras generate a new serial number everytime the computer is restarted?  If so, does this happen when only one camera is plugged in?

 

David A

0 Kudos
Message 9 of 13
(4,374 Views)

Hi David:

Thanks for replying.  Yes, I am using a USB hub, and I am beginning to suspect that might be part of the problem.

The serial numbers do not change, they are just 'moving' from camera to camera.  I always have the same four distinct serial numbers, but they are on different cameras sometimes (frequently) over power cycles of the PC.  And if I disconnect and reconnect one or more, there is definitely an issue as well.  One time I thought I saw the same serial number on two cameras, but I am not sure and have not recreated that yet.

These are all four identical Microsoft LifeCams (with unique serial numbers), which have a microphone on them as well.  I was getting confused at one point getting the serial number of that device when looking in DeviceManager.  Now I know to look only at the imaging devices list.

I added a USB PC card with four ports on it, and have not moved anything, and it appears that serial numbers are remaining fixed to the same cameras, but I have only cycled PC power, not disconnected and reconnected anything.  I am concerned about how to support this in the field, especially if a cameras has to be replaced.

I used higher end (and much more expensive) cameras in this application before, and they were much better behaved even when moving to different USB ports.  However, we did not need all the functionality (and overhead) so we are trying to make webcams work.  During evaluation I only had different models of webcams to use (no two alike) and that tested well enough since I could identify which was which, but in this case with only the serial number to distinguish the individual cameras we're running into this issue.

Rick

 

0 Kudos
Message 10 of 13
(4,370 Views)