Showing a semi-transparent Image object over an IVideoWindow in C# using DirectShow.NET

旧巷老猫 提交于 2019-12-20 04:19:50

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/7699024/showing-a-semi-transparent-image-object-over-an-ivideowindow-in-c-sharp-using-di

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!