windows OpenCV 2.3 (C++,QtGui),初始化某些特定 USB 设备和设置时出现问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7247475/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:58:02  来源:igfitidea点击:

OpenCV 2.3 (C++,QtGui), Problem Initializing some specific USB Devices and Setups

windowsmacosopencvwebcamvideo-capture

提问by QtGuy

I'm playing around with OpenCV since a while and I found some strange behavior of some specific capturing devices (PS3 Eye, Logitech C940, iSight) even on different Platforms.

一段时间以来,我一直在玩 OpenCV,我发现某些特定捕获设备(PS3 Eye、Logitech C940、iSight)甚至在不同平台上都有一些奇怪的行为。

Using OpenCV in Windows: All cams mentioned above work well. But when I want to use 2 cams and therefore create a second capture it will depend on the devices that I use in my Dual Cam Setup.

在 Windows 中使用 OpenCV:上面提到的所有凸轮都运行良好。但是,当我想使用 2 个摄像头并因此创建第二个捕获时,这将取决于我在双摄像头设置中使用的设备。

PS3 Eye + C940: no problems 2x C940: no problems

PS3 Eye + C940:没问题 2x C940:没问题

2x PS3 Eye: No chance, only the specific device that was connected first will initialize. The other PS3 Eye cannot be used the same time...No error events and no information about the problem is shown.

2x PS3 Eye:没机会,只有先连接的特定设备才会初始化。另一个 PS3 Eye 不能同时使用...没有错误事件,也没有显示有关问题的信息。

Now using OpenCV in MacOSX 10.7 (same for 10.6.x) there's different problems using the same devices and even the same QtGui-Application with 2 independent GLWidgets for displaying cv output in the QtGui.

现在在 MacOSX 10.7(与 10.6.x 相同)中使用 OpenCV,使用相同的设备甚至相同的 QtGui-Application 和 2 个独立的 GLWidgets 用于在 QtGui 中显示 cv 输出存在不同的问题。

Every Setup is great as long as it doesn't use a PS Eye in Mac OS. I tried macam and several other tools, but I just cannot get OpenCV to init this cam in OSX (I bought 3 for my project so hardware probs not very likely).

只要在 Mac OS 中不使用 PS Eye,每个设置都很棒。我尝试了 macam 和其他几种工具,但我无法让 OpenCV 在 OSX 中初始化这个凸轮(我为我的项目买了 3 个,所以硬件问题不太可能)。

I'm still wondering where the problem is...Maybe 2 PS Eye's would work in OSX if a single one did? I can't tell.

我仍然想知道问题出在哪里......如果一个的话,也许 2 个 PS Eye 可以在 OSX 中工作?我说不清。

I can even capture from 2x Logitech FULL HD Webcams simultaniously with nice performance.

我什至可以同时从 2x Logitech FULL HD 网络摄像头中进行捕获,并具有出色的性能。

Any Idea where Limitation could be with Dual PS Eye in Windows? Perhaps USB? And why can't OpenCV in OSX Capture from PSEye but macam can access the cam?

知道在 Windows 中使用 Dual PS Eye 会有什么限制吗?也许USB?为什么不能在来自 PSEye 的 OSX Capture 中使用 OpenCV 但 macam 可以访问凸轮?

I just want to understand what's happening. Perhaps anyone of you found a way to use at least a singe PS Eye in OSX? Or is this just not possible? Can't opencv somehow use the macam component?

我只是想了解发生了什么。也许你们中有人找到了一种在 OSX 中至少使用一个 PS Eye 的方法?或者这是不可能的?opencv 不能以某种方式使用 macam 组件吗?

回答by Andrey Kamaev

Video capturing is very platform-dependent area. So difference between Windows and OS X is rather expected than wondering. OpenCV utilizes a lot of video capturing APIs to support as many device models as possible. At the moment (OpenCV 2.3.1) it uses following libs/APIs on the back-end:

视频捕获是非常依赖平台的领域。因此,Windows 和 OS X 之间的差异是意料之中的,而不是想知道的。OpenCV 使用了大量的视频捕获 API 来支持尽可能多的设备模型。目前(OpenCV 2.3.1)它在后端使用以下库/API:

Windows:

视窗:

  • DirectShow (thought VideoInput library)
  • Microsoft's Video for Windows (VfW) API
  • CMU 1394 Digital Camera Driver
  • Matrox Imaging Library (MIL) (opt)
  • OpenNI camera drivers (opt)
  • XIMEA API for XIMEA devices (opt)
  • DirectShow(原以为 VideoInput 库)
  • Microsoft 的 Windows 视频 (VfW) API
  • CMU 1394 数码相机驱动程序
  • Matrox 成像库 (MIL) (可选)
  • OpenNI 相机驱动程序(可选)
  • XIMEA 设备的 XIMEA API (可选)

Linux:

Linux:

  • libdc1394 (API v1 or API v2) - IIDC standard compliant cameras (opt)
  • PvAPI for Prosilica GigE Vision cameras (opt)
  • unicap - The uniform API for image acquisition devices (opt)
  • video4linux (V4L or V4L2) (opt)
  • OpenNI camera drivers (for Kinect) (opt)
  • XINE (opt)
  • XIMEA API for XIMEA devices (opt)
  • libdc1394(API v1 或 API v2) - 符合 IIDC 标准的相机(选择)
  • 适用于 Prosilica GigE Vision 相机的 PvAPI (可选)
  • unicap - 图像采集设备的统一 API (opt)
  • video4linux(V4L 或 V4L2)(可选)
  • OpenNI 相机驱动程序(用于 Kinect)(可选)
  • XINE (选择)
  • XIMEA 设备的 XIMEA API (可选)

OS X:

操作系统:

  • QuickTime (opt)
  • QTKit (if no QuickTime, these two are mutually exclusive in OpenCV)
  • OpenNI camera drivers (opt)
  • XIMEA API for XIMEA devices (opt)
  • QuickTime (可选)
  • QTKit (如果没有QuickTime,这两者在OpenCV中是互斥的)
  • OpenNI 相机驱动程序(可选)
  • XIMEA 设备的 XIMEA API (可选)

Android:

安卓:

  • builtin Android camera
  • 内置安卓相机

* (opt) - these interfaces are optional - can be turned on or off during the OpenCV build and may require some additional SDK.

* (opt) - 这些接口是可选的 - 可以在 OpenCV 构建期间打开或关闭,并且可能需要一些额外的 SDK。

About PS3 Eye - on Windows, it is most probably some limitation of VideoInput library or installed driver. On OS X - first, ensure that your OpenCV is built with QuickTime support. And second, ensure that macam.component is correctly installed into the QuickTime. Here is a quote from their FAQ:

关于 PS3 Eye - 在 Windows 上,很可能是 VideoInput 库或已安装驱动程序的一些限制。在 OS X 上 - 首先,确保您的 OpenCV 是使用 QuickTime 支持构建的。其次,确保 macam.component 已正确安装到 QuickTime 中。这是他们的常见问题解答中的引用:

Why can't I use my webcam with other applications?

You can. Please copy the macam.component into the /Library/QuickTime/ directory (for access by all users on the system) or into the ~/Library/QuickTime/ (for access by only that user). If you have a previous copy, please delete it first. A restart is usually not needed, but if you have trouble, it's a good thing to try. To verify that your installation works, test with a simple program such as HackTVCarbon, VideoViewer, or BTV.

为什么我的网络摄像头不能与其他应用程序一起使用?

你可以。请将 macam.component 复制到 /Library/QuickTime/ 目录(供系统上的所有用户访问)或 ~/Library/QuickTime/(仅供该用户访问)。如果您有以前的副本,请先将其删除。通常不需要重新启动,但如果遇到问题,尝试一下是一件好事。要验证您的安装是否有效,请使用简单的程序(例如 HackTVCarbon、VideoViewer 或 BTV)进行测试。