Should I use WinForms or WPF for taking pics with

2019-07-16 06:07发布

问题:

We have a Logitech web cam that we want to get working with .NET. It needs to recognize the device, and be able to take a picture. We just installed VS 2008, and I was wondering if Microsoft made it easier to interact with devices with some of the newer stuff like WPF, Silverlight, or whatever. If anybody can point me in the right direction, or even provide some source code, it would really help a noob out.

Thanks in advance.

回答1:

You can try the VideoCaptureElement control in my WPF MediaKit library. It should have everything you need for showing a webcam in WPF and/or getting snapshots.



回答2:

I've used both, since the ultimate source of image data comes from either a COM component or a native DLL. I'm currently having a lot of success using WriteableBitmap to show the raw image data from a webcam. I've done the same with WinForms and the System.Drawing.Bitmap class.

With WPF, I can also easily use pixel shaders to change the image as I display it. I could also do this in WinForms, but it's easier in WPF.



回答3:

Try taking a look at EmguCV. It has a nice simple interface for interacting with a webcam. And some cool image processing routines as well.