我正在尝试通过 python 连接 Flir AX8 摄像头。该相机连接到笔记本电脑的以太网端口。因此,
VideoCapture()
无法识别该端口,我已尝试了它的所有索引(0、1、2),但它无法连接。谁能帮助我如何将相机连接到Python?
我尝试通过
VideoCapture(1)
和 VideoCapture('IP address')
连接
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
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'
导入CV2 将 numpy 导入为 np
虽然正确: cap=cv2.VideoCapture('http://admin:[电子邮件受保护]/snapshot.jpg?user=admin&pwd=admin&strm=0') ret,img=cap.read() cv2.imshow('视频输出',img) k=cv2.waitKey(1) 如果 k==ord('q'): 打破
cap.release() cv2.destroyAllWindows
获得图像后,如何获取温度值?
谢谢