水平翻转视频输入 C# DirectshowNet
我正在使用 directshownet 库中的 dxSnap 示例 http://directshownet.sourceforge.net/about.html< /a> 从我的网络摄像头捕获图像。有人知道如何水平翻转视频捕获吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
两种方式:
1) 在网络摄像头后面添加示例抓取器过滤器,为其提供回调,当回调获取数据时,只需将它们翻转到位即可。
2)(更简单)获得图片后,使用GDI(BitBlt)或任何其他方法翻转图片。
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.
在某些情况下,可以通过在
BITMAPINFOHEADER
中指定负高度来实现,参见自上而下与自下而上的 DIB。In some cases it is possible by specifying a negative height in the
BITMAPINFOHEADER
, see Top-Down vs. Bottom-Up DIBs.查看示例中的 DXSnap 示例,了解如何设置 ISampleGrabber 接口...它从示例抓取器回调中获取示例图像...只需做一点工作,您就可以支持一个事件来获取帧作为位图
...正确的方法是创建或找到一个过滤器添加到支持翻转框架的图表中... MontiVision 制作了一些很棒的过滤器...但并不便宜。
有些相机实际上支持这一点。如果您有 Logitec,您可以在 google 上搜索可以添加到图表中的 C# COM 接口包装器,大多数情况下必须在图表启动之前定义视频方向。
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.
我达到了你想要的效果,但我使用了AForge框架(它使用DirectShow接口来访问视频源)。我所做的就是在每个新帧上调用事件处理程序并水平翻转这些帧:
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: