/DirectShowVideoToXna

Display camera feed (at configurable resolutions) on XNA as a texture using Directshow.NET

Primary LanguageC#

#DirectShowVideoToXna

This is an XNA 4.0 game component that generates and updates a Texture2D instance from a connected camera's feed using DirectShow.NET. A buffer of grayscale bytes is also exposed for use in image processing

The exposed Texture2D is flipped vertically and has the red and blue channels swapped with respect to XNA colors. To achieve a decent framerate at higher resolutions, some tasks have been deferred to the GPU. These tasks are the swapping of red and blue channels, and horizontal and/or vertical flipping. This can be seen in the Demo game.

The exposed buffer of grayscale bytes is a mirror (flipped horizontally) of the camera feed. Again, this is to avoid CPU load while processing the camera feed. This flip has to be taken into account if this mirrored feed is not desired. The Demo game uses this mirror feed.

#####References: