简体   繁体   English

如何区分OpenCV摄像机?

[英]How to distinguish OpenCV cameras?

I am writing C++ class for managing multiple cameras and reading frames from them. 我正在编写用于管理多个摄像机并从中读取帧的C ++类。 Let's say it is wrapper for OpenCV. 假设它是OpenCV的包装器。 Currently I am finding cameras by trying to create devices from 0-10 range and If there is output I know that I've found working camera. 目前,我正在尝试通过创建0-10范围内的设备来查找相机,如果有输出,我知道我已经找到了可以使用的相机。 I can always save internal IDs of those cameras to distinguish them but what If another camera is plugged in? 我总是可以保存这些摄像机的内部ID来区分它们,但是如果插入了其他摄像机怎么办? It may break the order of IDs. 可能会破坏ID的顺序。 So is there any way to distinguish OpenCV cameras for example by getting their hardware IDs? 那么,有没有办法通过获取硬件ID来区分OpenCV摄像机?

I know this doesn't help you much, but the short answer is "No, OpenCV doesn't currently provide that capability." 我知道这对您没有太大帮助,但是简短的回答是“不,OpenCV当前不提供该功能。”

According to the doc , any hardware ids are not properties you can retrieve using the get method or any other. 根据文档 ,任何硬件ID都不是您可以使用get方法或任何其他方法检索的属性。

Having said that, if you're very intent on using OpenCV, I would still test the behavior of OpenCV 2.4.10 on various platforms and using various middleware and see how it behaves. 话虽如此,如果您非常想使用OpenCV,我仍将在各种平台和各种中间件上测试OpenCV 2.4.10的行为,并查看其行为。 If you get a consistent behavior, then you can run with it, but be somewhat ready for it to break in the future. 如果您获得一致的行为,则可以使用它,但是要为将来的崩溃做好一些准备。 What would work for you is that OpenCV is using various middleware in the backend, such as V4L, Qt, etc., and these are well-maintained and more-or-less consistent. 对您有用的是,OpenCV在后端使用各种中间件,例如V4L,Qt等,并且这些中间件维护良好且几乎一致。

In retrospect, I would stay away from OpenCV's video interface altogether right now for commercial software, unless you're okay with the situation I described. 回想起来,除非您对我描述的情况还满意,否则我现在将完全不使用OpenCV的视频界面来使用商业软件。 Beware that OpenCV 3.0 videoio library is unstable at this point and has open bug reports. 请注意,此时OpenCV 3.0 videoio库是不稳定的,并且具有开放的错误报告。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM