1

I've been using DirectShow.NET to interface with a webcam in C# and so far everything has been going smoothly. However, right now I'm working on trying to set up a method to "crop" an image (while it's still being displayed as a webcam preview).

Basically, I'm trying to show some kind of a mostly transparent image on top of the IVideoWindow object. Dealing with transparency in C#, however, has been pretty far from a cakewalk.

So, how can I layer an Image object on top of an IVideoWindow? Thanks!

Roman R.
  • 68,205
  • 6
  • 94
  • 158
ashays
  • 1,154
  • 1
  • 12
  • 30
  • Technically, you can't. Because DirectShow doesn't interact with the display in the same way as other objects. However, there are ways to achieve what you want using DirectShow featuers. You just can't overlay an image and expect it to converup your DirectShow window. See Roman's answer below. – Erik Funkenbusch Oct 08 '11 at 20:28

1 Answers1

2

There are two approaches how to achieve this:

  • to use a video transformation filter and deliver mixed video to the renderer (that is, picture + your overlay)
  • or, use VMR's 'mixerbitmap` feature to overlay at presentation time

DirectShow.NET has a sample for the second mentioned above:

Samples\VMR9\BitMapMixer BitmapMixer is an example of how to draw things over a video using VMR9.

Another sample there:

Samples\Players\DxText A sample application showing how to superimpose text strings on a datastream. The stream is read from an avi file.

Also discussed many times on MSDN Forums.

Roman R.
  • 68,205
  • 6
  • 94
  • 158