調用手機攝像頭,利用app ip攝像頭
cv2.namedWindow("camera", 2) # 開啟ip攝像頭 video = "http://admin:[email protected]:8081/" # 此處@後的ipv4 地址需要改為app提供的地址 cap = cv2.VideoCapture(video) # 開攝像頭 while True: ret, image_np = cap.read() cv2.imshow('camera', image_np) key = cv2.waitKey(10) # 按鍵處理 if key == 27: # esc鍵退出 print("esc break...") break print(cap.get(cv2.cv2.CAP_PROP_FRAME_COUNT)) cap.release() cv2.destroyAllWindows()