就拿Persenels的图片与连接到电脑数码相机 [英] Take a Picture of Persenels with a Digital Camera Attached To Computer

查看:208
本文介绍了就拿Persenels的图片与连接到电脑数码相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要共创双赢表单应用程序可连接到附在我Computer.I数码相机想看Persenels计算机的实时查看,然后采取Persenels的图片。

I Want Create a Win-Form Application Can be Connect to a Digital Camera Attached to My Computer.I Want See a LiveView of Persenels in Computer And Then Take a Picture of Persenels.

我如何可以实现此操作?

How Can I Implement This Action?

什么相机可以使用吗?

哪个组件或图书馆我可以使用?

What Component Or Library Can I Use??

我可以使用SDK工具??

What SDk Tools Can I Use??

请帮助我..

推荐答案

您可以使用Windows图像采集API做到这一点。得到这个开始与项目+添加引用,浏览选项卡,导航到C:\windows\system32\wiaaut.dll。这是一个COM组件,你会得到一个互操作库它在WIA命名空间中的接口类型。

You can do this with the Windows Image Acquisition API. Get this started with Project + Add Reference, Browse tab, navigate to c:\windows\system32\wiaaut.dll. That's a COM component, you'll get an interop library for it with interface types in the WIA namespace.

您想要做的第一件事就是让相机的参考使用WIA.ShowSelectDevice()。它返回一个设备对象如果只有一个摄像头连接,一个对话框让用户选择,如果有更多的。像这样的:

First thing you want to do is get a reference to the camera, use WIA.ShowSelectDevice(). It returns a Device object if there's only one camera attached, a dialog to let the user select if there are more. Like this:

    public static WIA.Device SelectCamera() {
        var dlg = new WIA.CommonDialog();
        try {
            return dlg.ShowSelectDevice(WIA.WiaDeviceType.CameraDeviceType, false, false);
        }
        catch (System.Runtime.InteropServices.COMException ex) {
            if (ex.ErrorCode == -2145320939) return null;
            throw;
        }
    }

这应该让你开始。退房的代码片段在这个 MSDN页更多的事情,你可以用API做的。要注意的是并不是所有的相机都允许你交互使用他们时,他们连接到机器。我的小气鬼点和射击没有。

That ought to get you started. Check out the code snippets at this MSDN page for more of the thing you can do with the API. Beware that not all cameras allow you do use them interactively when they are attached to the machine. My cheapo point-and-shoot doesn't.

这篇关于就拿Persenels的图片与连接到电脑数码相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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