You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
603B

  1. import cv2
  2. import numpy as np
  3. # 创建VideoCapture对象并打开WebRTC视频流
  4. cap = cv2.VideoCapture('webrtc://221.230.150.241:10800/rtc/stream_14')
  5. while True:
  6. print(cap.isOpened())
  7. # 读取视频流的一帧
  8. ret, frame = cap.read()
  9. if ret:
  10. # 在这里进行帧处理
  11. # 例如,可以对每一帧进行图像处理、对象检测等操作
  12. # 显示处理后的帧
  13. cv2.imshow('Frame', frame)
  14. # 按下'q'键退出循环
  15. if cv2.waitKey(1) & 0xFF == ord('q'):
  16. break
  17. # 释放VideoCapture对象和窗口
  18. cap.release()
  19. cv2.destroyAllWindows()