PDA

View Full Version : problem with multiple cameras



alex84
August 21, 2011, 21:25:21
hello,
i'm working on a program that processes the livestream of two cameras simultaneously.
the cameras are plugged into a usb-hub which is connected to the computer.
here is the problem: i start windows, plug in the hub with the cameras connected to it and start my program. everything works as expected. the problem is if i disconnect the hub from the computer and reconnect it again. if i start my program after that situation, it recognizes just one of the two cameras. that confuses me. the fact that it recognizes only one camera makes me think that it could be a resource problem.
but i am freeing all occupied resources in my code afaik.
the problem does not occur if i start and close my program several times. it's just after unplugging the hub.
any ideas?

kind regards,
alex

alex84
August 22, 2011, 07:48:06
addon: in my program i start two livestreams.
i forgot to mention that "recognizing just one of the cameras" means that i only see the livestream of one cam and not both.

Stefan Geissler
August 22, 2011, 09:42:16
Hello Alex,

I understand, you see both cameras listed by your program, but only one provides a live video, while the other camera does not provide any images. Usually this is a problem of bandwidth. Please make sure, both cameras start with a valid frame rate, that means, you set the frame rate explicitly before you call startLive() or you use use LoadDeviceState(). Where the saved device state contains suitable frame rates.

If the cameras were running and providing live video and you disconnect the hub, then the cameras do not recognize, that they lost connection to the computer. This may can cause the same problem. Therefore, if the hub is disconnected, you may also disconnect and reconnect the power supply. This definitely stops the cameras and you should receive the same camera state as at full computer start.

alex84
August 22, 2011, 11:45:11
If the cameras were running and providing live video and you disconnect the hub, then the cameras do not recognize, that they lost connection to the computer. This may can cause the same problem. Therefore, if the hub is disconnected, you may also disconnect and reconnect the power supply. This definitely stops the cameras and you should receive the same camera state as at full computer start.

in fact the cameras are industry cameramodules which do not have their own power supply. but i will try to set the framerates explicitly. thanks for the moment.

alex84
August 24, 2011, 18:56:49
@Stefan Geissler: finally i found the time to test your suggestions. setting the framerate explicitly doesn't help.
the problem seems to be the usb-hub.
situation: i start windows, plug in the usb-hub (which is connected to the two cameras) and start my program. everything fine. after unplugging the hub and replugging it, my program recognizes just one cam. if i do not unplug the usb-hub but rather just unplug the two cameras from the usb-hub and then reconnect them, everything works (again) as expected. so i think the problem is the usb-hub. somehow the camera driver doesn't close the connection to the devices if i unplug the whole hub, but it closes the connection if i just unplug the cameras from the hub ... weird.
unfortunately i don't have another hub to check if the problem appears only with this hub.
do you think that the problem occurs with every usb-hub? if so, do you know a solution?

Stefan Geissler
August 25, 2011, 08:13:21
Hi,

Please let me know, which camera model you use. Also did you had a look in the Windows Device Manager to see, how Windows reacts?

alex84
August 25, 2011, 22:00:52
hi,
today i borrowed another usb-hub from a friend. the (un)plug thing works now.
so the problem seems to be our usb-hub. i consider the whole thing as solved (for now) ;)
thanks for your help.

kind regards,
alex