[英]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.