简体   繁体   English

如何在 OpenCV/Python/OSX 中从 PointGrey USB 相机捕获帧?

[英]How can I capture frames from a PointGrey USB camera in OpenCV/Python/OSX?

PointGrey is a leading manufacturer of machine vision cameras, but unfortunately their support for Mac OS is very limited. PointGrey 是机器视觉相机的领先制造商,但不幸的是,他们对 Mac OS 的支持非常有限。 A www search led me to guess that I need to install libusb and libdc1394 in order to recognize the camera, which i did using brew. www 搜索让我猜测我需要安装 libusb 和 libdc1394 才能识别相机,这是我使用 brew 完成的。 This did not work.这没有用。

I don't understand exactly how libusb and libdc1394 libraries work under the hood, other than that they handle the hand-shaking with the camera and data transfer via the USB bus.我不完全了解 libusb 和 libdc1394 库是如何在后台工作的,除了它们通过 USB 总线处理与相机的握手和数据传输。 OpenCV usually makes it incredibly easy to open a camera and start processing frames, but unfortunately when it doesn't work it's not clear how to debug. OpenCV 通常使打开相机并开始处理帧变得异常容易,但不幸的是,当它不起作用时,不清楚如何调试。 I found python wrappers for libusb and libdc1394 and included them in my code, which resulted in no errors, but no luck grabbing frames either.我找到了 libusb 和 libdc1394 的 python 包装器,并将它们包含在我的代码中,这没有导致错误,但也没有运气抓取帧。

If you don't have an exact answer, suggest strategies for solving this problem ie how should I systematically approach this, diagnosing all the possible failure modes.如果您没有确切的答案,建议解决这个问题的策略,即我应该如何系统地解决这个问题,诊断所有可能的故障模式。 Is there a way that I can see more of what's going on when OpenCV tries to detect and read from a camera?当 OpenCV 尝试检测和读取相机时,有没有办法让我看到更多发生的事情?

My python/opencv code works well with a simple capture = cv2.VideoCapture(0) but doesn't work with capture = cv2.VideoCapture(1) , giving output as follows:我的 python/opencv 代码适用于简单的capture = cv2.VideoCapture(0)但不适用于capture = cv2.VideoCapture(1) ,给出 output 如下:

Warning, camera failed to properly initialize!
Cleaned up camera.

Typically cv2.VideoCapture(0) will give the built-in camera on my macbook, and from what I understand cv2.VideoCapture(1) will give the next available camera (ie plugged in through USB).通常 cv2.VideoCapture(0) 会给我的 macbook 上的内置摄像头,据我了解 cv2.VideoCapture(1) 会给下一个可用的摄像头(即通过 USB 插入)。

I know the camera works well on a windows machine (in Windows Movie Maker).我知道相机在 windows 机器(在 Windows Movie Maker 中)上运行良好。 Do I need to do something further under the hood to get python and opencv to recognize the camera under OS X?我是否需要在后台做一些进一步的事情才能让 python 和 opencv 在 OS X 下识别相机?

Many years later, we can answer this question.多年以后,我们可以回答这个问题。 FLIR, which acquired PointGrey, has released Spinnaker, a cross-platform SDK with a UI and a set of pre-compiled examples for accessing the camera: https://www.flir.com/support-center/iis/machine-vision/downloads/spinnaker-sdk-and-firmware-download/收购 PointGrey 的 FLIR 发布了 Spinnaker,这是一款跨平台的 SDK,带有 UI 和一组用于访问相机的预编译示例: https://www.flir.com/support-center/iis/machine-vision /downloads/spinnaker-sdk-and-firmware-download/

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

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