1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import time
- import cv2
- from wvp import WvpProxy, Rtsp
- def row_main():
- rtsp = Rtsp()
- proxy = WvpProxy()
- did, cid = "34020000001320000001", "34020000001310000001"
- url = proxy.start(did, cid)
- rtsp.connect(url)
- for item in rtsp.read_stream(1): # 每5秒从图像流中读取一帧图像数据
- # item = rtsp.resize(item, 2) # 长宽压缩3倍
- cv2.imshow("raw", item) # 显示原图
- # cv2.imshow("detr", rtsp.detr(item)) # 显示检测结果
- cv2.waitKey(1)
- rtsp.close()
- proxy.stop(did, cid)
- def main():
- rtsp = Rtsp()
- proxy = WvpProxy()
- did, cid = "34020000001320000001", "34020000001310000001"
- try:
- url = proxy.start(did, cid)
- print(url)
- rtsp.connect(url)
- while True:
- time.sleep(60)
- except:
- rtsp.close()
- proxy.stop(did, cid)
- time.sleep(2)
- main()
- if __name__ == "__main__":
- main()
|