I am having trouble streaming from a FLIR Grasshopper3 to OpenCV. Is there a way to stream directly from the FLIR camera to my code using python? When I use the code below, cv.Videocapture is not able to recognize the FLIR camera as a video source. I have tried different values in 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.
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'
I was able to use the Acquisition.py and AcquisitionOpenCV.py files to integrate the camera into my code. The files can be found when downloading FLIR's Spinnaker SDK found here: https://www.flir.com/products/spinnaker-sdk/