【发布时间】:2019-06-28 07:15:50
【问题描述】:
我正在尝试通过 python 连接 Flir AX8 相机。此摄像头连接到笔记本电脑的以太网端口。所以,VideoCapture() 无法识别端口,我已经尝试了它的所有索引(0、1、2),但它没有连接。谁能帮我把相机连接到python?
我尝试通过VideoCapture(1) 和VideoCapture('IP address') 进行连接
使用 IP 地址:
import cv2, time
video=cv2.VideoCapture('http://admin:admin@IP address/')
a=0
while True:
a=a+1
check, frame = video.read()
print(check)
print(frame)
#gray=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow("Capturing",frame)
key=cv2.waitKey(1)
if key== ord('q'):
break
print(a)
video.release()
cv2.destroyAllWindows
使用索引 0、1、2:
import cv2, time
video=cv2.VideoCapture(1)
a=0
while True:
a=a+1
check, frame = video.read()
print(check)
print(frame)
#gray=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow("Capturing",frame)
key=cv2.waitKey(1)
if key== ord('q'):
break
print(a)
video.release()
cv2.destroyAllWindows
在这两种情况下我都会遇到以下错误:
False
None
Traceback (most recent call last):
File "C:\Users\yashw\Desktop\ex.py", line 15, in <module>
cv2.imshow("Capturing",frame)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
【问题讨论】:
-
那么用什么协议来发送数据呢?您是否只想保存相机中视频流的屏幕截图?您是否正在积极尝试通过其 API 控制相机
-
我正在使用这台相机来寻找物体的位置。该摄像机通过 FLIR IP CONFIG 连接。软件。
-
你读过它关于如何configure the server?的说明
-
是的,但没有帮助。