简体   繁体   English

用连接到计算机的数码相机拍摄人像

[英]Take a Picture of Persenels with a Digital Camera Attached To Computer

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. 我想创建一个Win-Form应用程序,可以连接到我的计算机上连接的数码相机。我想在计算机中查看Persenels的LiveView,然后拍摄Persenels的图片。

How Can I Implement This Action? 如何执行此操作?

What Camera Can I Use? 我可以使用什么相机?

What Component Or Library Can I Use?? 我可以使用哪些组件或库?

What SDk Tools Can I Use?? 我可以使用哪些SDk工具?

Please Help me... 请帮我...

You can do this with the Windows Image Acquisition API. 您可以使用Windows Image Acquisition API执行此操作。 Get this started with Project + Add Reference, Browse tab, navigate to c:\\windows\\system32\\wiaaut.dll. 首先使用Project + Add Reference,在“浏览”选项卡上导航到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. 那是一个COM组件,您将为其获取一个Interop库,该库具有WIA命名空间中的接口类型。

First thing you want to do is get a reference to the camera, use WIA.ShowSelectDevice(). 您要做的第一件事是获取对摄像机的引用,请使用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. 如果仅连接了一个摄像机,它将返回一个Device对象,一个对话框让用户选择是否有更多摄像机。 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;
        }
    }

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. 在此MSDN页面上查看代码段,以了解您可以使用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. 我的cheapo傻瓜相机没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用vb.net或asp.net或C#通过USB线连接到我的电脑的数码相机拍照? - how do i take picture from a digital camera attached to my computer throught USB cable using vb.net or asp.net or C#? 尝试使用Android.Hardware.Camera拍照时出错 - Error trying to take picture with Android.Hardware.Camera 使用C#从集成笔记本电脑相机拍照 - Take a picture from Integrated Laptop Camera using C# EDSDK 2.13。 在计算机上接收新照片时,获取拍摄照片的相机的参考 - EDSDK 2.13. Get the reference of the camera that took the picture when receiving a new picture on the computer 如何使用iOS相机拍照并使用Xamarin将图像保存到相机胶卷 - How to take a picture with iOS camera and save the image to camera roll using Xamarin 数码相机算法 - Digital camera algorithms 自定义面板作为附件图片 - Custom panel as attached picture 如何使用现有的相机应用程序(不是使用 MediaCapture 创建一个)并在 windows phone 8.1(WinRT) 中拍照? - How to use existing camera app(not create one using MediaCapture) and take picture in windows phone 8.1(WinRT)? 如何在 Windows 手机/桌面上使用相机拍摄照片/照片 - How do I take a picture/photo using a camera on windows phone/desktop 为什么即使我已安装相机也未安装相机? - Why is there no camera attached, even if I've attached it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM