各位好,
平台rk3399pro, fedora 平台,
安装了VLC,可以获取到网络摄像头图像;
但是使用下面的语句,无法获取到网络摄像头的图像; 如果把下面的cap = cv2.VideoCapture(url) 改为 cap = cv2.VideoCapture(0);可以获取到USB摄像头的图像;
麻烦各位指导一下,谢谢
import cv2 import sys import time
url='rtsp://ABC:ABC@192.168.10.88:554/cam/realmonitor?channel=2&subtype=0 ' print(url) cap = cv2.VideoCapture(url) cap.set(3, 480) time.sleep(3) print(cap.isOpened()) print(sys.version) print(cv2.__version__) while cap.isOpened(): print('camera opened') #ret_flag,img_camera = cap.read() #cv2.imshow("camera", img_camera) k = cv2.waitKey(1) if k == ord('s'): cv2.imwrite("test.jpg", img_camera) if k == ord('q'): break
cap.release() cv2.destroyAllWindows()
|