简体   繁体   English

使用 Python 从 FLIR 相机流式传输 OpenCV 视频

[英]OpenCV Video streaming from FLIR Camera using Python

I am having trouble streaming from a FLIR Grasshopper3 to OpenCV.我在从 FLIR Grasshopper3 流式传输到 OpenCV 时遇到问题。 Is there a way to stream directly from the FLIR camera to my code using python?有没有办法使用 python 直接从 FLIR 相机流式传输到我的代码? When I use the code below, cv.Videocapture is not able to recognize the FLIR camera as a video source.当我使用下面的代码时,cv.Videocapture 无法将 FLIR 摄像机识别为视频源。 I have tried different values in cv.Videocapture.我在 cv.Videocapture 中尝试了不同的值。 While 0 and -1 link to the webcam app I use (iVcam), using different numbers that should find other Camera sources (1 and 2) do not identify the FLIR camera.虽然 0 和 -1 链接到我使用的网络摄像头应用程序 (iVcam),但使用不同的数字应该可以找到其他摄像头源(1 和 2)并不能识别 FLIR 摄像头。

import numpy as np
from object_detection.utils import visualization_utils as vis_util 
import cv2 as cv
from time import time


cap = cv.VideoCapture(1)

while (True):
    ret,frame = cap.read()
    print(frame.shape)
    cv.imshow('frame',frame)

    if cv.waitKey(1) & 0XFF == ord('q'):
        break 

cap.release()
cv.destroyAllWindows()

Traceback (most recent call last): File "C:\\Desktop\\flirtest.py", line 10, in print(frame.shape) AttributeError: 'NoneType' object has no attribute 'shape'回溯(最近一次调用):文件“C:\\Desktop\\flirtest.py”,第 10 行,在打印(frame.shape)中 AttributeError: 'NoneType' object has no attribute 'shape'

I was able to use the Acquisition.py and AcquisitionOpenCV.py files to integrate the camera into my code.我能够使用 Acquisition.py 和 AcquisitionOpenCV.py 文件将相机集成到我的代码中。 The files can be found when downloading FLIR's Spinnaker SDK found here: https://www.flir.com/products/spinnaker-sdk/下载 FLIR 的 Spinnaker SDK 时可以找到这些文件: https : //www.flir.com/products/spinnaker-sdk/

The new version of Spinnaker SDK does not have AcquisitionOpenCV.py file in it.新版Spinnaker SDK中没有 AcquisitionOpenCV.py 文件。 There is another file AcquireAndDisplay.py which works independent of OpenCV thus reducing the list of dependencies to display FLIR camera view.还有另一个文件 AcquireAndDisplay.py 独立于 OpenCV 工作,从而减少了显示 FLIR 相机视图的依赖项列表。

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

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