无法读取 C# 中的 WIA 项目时间戳对象
大家好,我有一个问题,我相信最终会出现一个小语法问题。我希望。我正在使用 C# 在 Windows 7 计算机上使用 WIA 2.0 将数据从相机提取到应用程序中。问题涉及到时间戳。在检查图像的时间戳是否在某个范围内之前,我不想传输图像。这是代码中被删减的重要部分。这里的示例来自我的测试工具,我只是一口气完成所有操作,而不是来自真实的代码。再说一次,如果我忽略时间,我可以让一切顺利进行,但这不是一个选择。
WIA.DeviceManager devMgr = new WIA.DeviceManager();
foreach (DeviceInfo info in devMgr.DeviceInfos)
{
if (info.Type == WiaDeviceType.CameraDeviceType) //grab the first camera
{
cameraDevice = info.Connect();
break;
}
}
这里相机中有一个包含 i 个项目的循环(此时每个项目都是一张图片)
WIA.Item item = cameraDevice.Items[i];
timestamp = item.Properties.get_Item("Item Time Stamp").get_Value().ToString();
现在在最后一行它只返回 System.__ComObject。我不知道如何从这个对象中获取值,我无法将其转换/转换为任何有用的东西,它没有我能找到的属性。谁能帮我从这个时间戳对象中获取值?
顺便说一句,令人惊讶的是,世界上使用 C# 和 WIA 的人的样本如此之少。只是说。
Hi all, I have a problem that I believe will end up a minor syntax problem. I hope. I am pulling data from a camera into an app using WIA 2.0 on a windows 7 machine using c#. The problem involves the timestamp. I don't want to transfer the image until I check if its timestamp is within a range. Here is the chopped down important part of the code. The sample here is from my test harness where I just do everything in one fell swoop, not from the real code. Again, I can make everything work fine if I ignore time, but that isn't an option.
WIA.DeviceManager devMgr = new WIA.DeviceManager();
foreach (DeviceInfo info in devMgr.DeviceInfos)
{
if (info.Type == WiaDeviceType.CameraDeviceType) //grab the first camera
{
cameraDevice = info.Connect();
break;
}
}
Here there is a loop of i items in the camera (each item is a pic at this point)
WIA.Item item = cameraDevice.Items[i];
timestamp = item.Properties.get_Item("Item Time Stamp").get_Value().ToString();
Now on that last line it just returns System.__ComObject
. I have no idea how to get the value out of this object, I can't cast/transmutate it to anything useful, it has no properties I can find. Can anyone help me with getting the value out of this timestamp object?
On a side note, its amazing how few samples there are in the world of people using c# and WIA. Just sayin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是你想要的:
This is what you want:
这可能会帮助您
http://www.xtremevbtalk.com/archive/ index.php/t-288758.html
This one might help you
http://www.xtremevbtalk.com/archive/index.php/t-288758.html