在相机预览中绘制矩形/位图 [英] Draw rectangle/bitmap in the camera preview

查看:71
本文介绍了在相机预览中绘制矩形/位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在使用相机的.NET CF 2.0应用程序进行工作,显示预览并允许用户拍照.我正在使用CameraCaptureDialog组件,我想在预览屏幕上绘制一个矩形,但是我做不到...有任何想法吗?
您认为DirectShow中的Overlay混音器过滤器有用吗?如果是这样,您有什么例子吗? (问题是我在CF 2.0上工作,所以很多在这里无法正常使用的解决方案都无法正常工作.).
预先感谢,

Giacomo

Hi everybody, I''m working on a .NET CF 2.0 application that uses the camera, showing the preview and allowing the user to take a photo. I''m using the CameraCaptureDialog component and I wanted to draw a rectangle on the preview screen, but I wasn''t able to do it... Any ideas?
Do you think the Overlay mixer filter in DirectShow can be useful? If so, do you have any example? (The problem is I work on the CF 2.0, so many solutions that work ok for the normal framework here don''t work...).
Thanks in advance,

Giacomo

推荐答案

为什么要使用DirectShow以及诸如叠加管理器之类的笨拙而又肮脏的东西?您可以在不需要这样的地方使用WPF,因为WPF本身基于DirectX.

由于我也遇到了非常类似的问题,因此我尝试在视频上叠加一些WPF UIElement.没问题.您可以将视频放在任何UIElement的前面,也可以将任何UIElement放在视频的上面,可以使它成为半透明的,并通过它或类似的东西来观看视频,而没有任何麻烦.此外,还有许多其他原因使WPF优于Forms,但这在很大程度上取决于您的应用程序.

如果仅使用可用于WPF的Windows .NET(仅适用于Windows),则没有任何理由使用其他任何东西(如Forms). (例如,如果您计划在Mono的其他平台上使用CLR,则可以使用Forms,但WPF不可用;据我所知,甚至没有计划进行开发,但是对于Windows,您将没有问题.)

—SA
Why would you use DirectShow and such a cumbersome and dirty thing as overlay manager? You could use WPF where you don''t need anything like that, because WPF itself is based on DirectX.

As I had very similar problems, too, I tried to overlay some WPF UIElements on the video. No problems whatsoever. You can put video in front of any UIElement, you can put any UIElement on top of video, you can make is semi-transparent and see the video through, or anything like that, without any hassles. Besides, there are many other reasons which makes WPF beneficial over Forms, but it strongly depends on your application.

If you are working with .NET for Windows only, where WPF is available, there is no a single reason to use anything else (like Forms). (If you plan to use CLR on other platforms, with Mono, for example, you can use Forms, but WPF is not available; to best of my knowledge, not even planned for development, but with Windows you wouldn''t have any problems.)

—SA


这篇关于在相机预览中绘制矩形/位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆