Reputation: 1652
I'm using the dxSnap sample from the directshownet library http://directshownet.sourceforge.net/about.html to capture an image from my webcam. Does anybody know how to flip the video capture horizontally?
Upvotes: 2
Views: 3879
Reputation:
I achieved your desired effect but I used the AForge Framework (it uses the DirectShow interface to access video sources). All I did was to call an event handler on every new frame and flip those frames horizontally:
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
eventArgs.Frame.RotateFlip(RotateFlipType.RotateNoneFlipX);
}
Upvotes: 1
Reputation: 822
Look at the DXSnap example in the samples to see how the ISampleGrabber interface is setup... it grabs a sample image from the sample grabber callback... with a little work you can sup an event to get frames as bitmaps...
The correct way to do this would be to create or find a filter to add to your graph that supports flipping the frame... MontiVision makes some great filters...not cheep though.
some camera's actually support this. if you have a logitec you can google for the C# COM interface wrapper that you can add to your graph,most cases the video orientation has to be defined before the graph is started.
Upvotes: 1
Reputation: 3008
In some cases it is possible by specifying a negative height in the BITMAPINFOHEADER
, see Top-Down vs. Bottom-Up DIBs.
Upvotes: 1
Reputation: 1046
Two ways: 1) Add the Sample Grabber filter after the webcam, provide it with a callback and when your callback gets the data just flip them inplace. 2) (easier) After you got the picture, use GDI (BitBlt) or any other methods to flip a picture.
Upvotes: 1