Mirror webcam image

May 19, 2011 at 10:17 PM

Is there any way to set the webcam image to be flipped like in a mirror?

Artenatively, is there a way to get and modify the rendered data just before it's drawn? So far I only managed to flip the meshes by modifying the scene.CameraNode.Camera.View

I tried this  to get the image into a texture but this doesn't seems to work, the texture is always blank...

 

//array to store info
int[] picture =new int [scene.VideoCapture[0].Height*scene.VideoCapture[0].Width];
IntPtr iptr = IntPtr.Zero;

Texture2D text = new Texture2D(this.GraphicsDevice, scene.VideoCapture[0].Width, scene.VideoCapture[0].Height);
            
//putting picture info into the array
scene.VideoCapture[0].GetImageTexture(picture,ref iptr);

//making texture from the array
text.SetData<int>(picture);

Thanks for your help.

Coordinator
Jun 1, 2011 at 2:32 AM

Are you going to do marker tracking? If not, you can simply change the RenderFormat (it only has get property, so you need to change the source code in Goblin XNA) of your capture device (e.g., DirectShowCapture) to flip horizontally. If you're doing marker tracking, it'll be more complicated since this flipping will not affect the image passed to the marker tracker. You will have to change your capture device's GetTexture(...) method as well for the IntPtr data.

Ohan

Jul 31, 2011 at 6:57 PM
Edited Aug 6, 2011 at 9:32 PM

Is it possible to maybe do just marker tracking, but that it goes in 1st person, because, when you put your camera in front of you, your moves are kinda in the wrong way, if you understand me... For example, when I move my left arm to left, the me in the monitor does the same thing to my right. So, what I'm trying to say is: Is it possible to have web camera collect marker data, and have another(virtual) camera attached to the marker(on my forehead :D ) so I could see my moves from 1st person?

In short, what I'm trying to say is: Is it possible to have a primary virtual camera if physical camera is on and watching markers?

Aug 6, 2011 at 9:44 PM
Edited Aug 6, 2011 at 9:44 PM

Got it, had a bug in the code, sorry...

It's very possible :D

Aug 22, 2011 at 12:11 AM

Can you tell me how you did it work?

I am having troubles flipping the camera....I have a Logitech 910 HD, and when I flip it through the cam software, the objects in the marker go crazy...

Any help would be appreciated.

Thanks!

Mar 13, 2013 at 4:02 PM
Hi mastermana!

How did you flip the tracking and the screen hotizontally? what did you change in the GetTexture method?