This project is read-only.

Change Camera

Jul 17, 2011 at 12:05 AM
Edited Jul 18, 2011 at 1: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.

Coordinator
Jul 19, 2011 at 7: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).

Ohan

Jul 20, 2011 at 12:40 AM

Ya got it! Thats really cool! You rock!

Jul 13, 2012 at 4: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?

Thank.