Change Camera

Jul 16, 2011 at 11:05 PM
Edited Jul 18, 2011 at 12:20 AM

I have a Laptop with a cam, and a normal webcam, how can I switch from one to another in my project.

With my webcam I get the error : Failed to set the resolution to 640x480..

P.S: For the model, why we must have the .xnb.

Jul 19, 2011 at 6:35 AM

You switch camera by passing different video ID to IVideoCapture.InitVideoCapture(...) function. If you have two cameras, you can try ID 0 and 1.

.xnb is XNA format. You don't have to load from the .xnb file, but that's the standard way for XNA. For details, please search on the XNA forums (e.g., App Hub).


Jul 19, 2011 at 11:40 PM

Ya got it! Thats really cool! You rock!

Jul 13, 2012 at 3:39 PM

Thank ohan for the clue.

But I have a question, I got camera 0 and 1. Follows your instruction, I can switch from 0 to 1. But then I can't switch it back from 1 to 0 by using IVideoCapture.InitVideoCapture(...). It said that it is already init and in the scence.

Is there away to overcome this?