标签:while color imp des window win 自带 apt rtsp
""" 读取视频流(相机,视频,ip相机) """ import cv2 # url = "rtsp://admin/password@ip:port/live" # ip相机 # cap = cv2.VideoCapture("./video/01.mp4") # 视频 cap = cv2.VideoCapture(0) # 0自带相机,1外接相机 # 循环读取每一帧 while(cap.isOpened()): ret, frame = cap.read() # True (480, 640, 3) gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # 灰度图 # cv2.namedWindow("resized", 0) # 0可以改变窗口大小了 # cv2.resizeWindow("resized", 640, 480) cv2.imshow("frame", gray) # 显示图片 if cv2.waitKey(1) & 0xFF == ord("q"): # 按q退出 break # 释放并关闭所有窗口 cap.release() cv2.destroyAllWindows()
标签:while color imp des window win 自带 apt rtsp
原文地址:https://www.cnblogs.com/jumpkin1122/p/11509785.html