add RTSP example
This commit is contained in:
24
code/Python/opencv/capture.py
Executable file
24
code/Python/opencv/capture.py
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import cv2
|
||||
|
||||
RTSP_ADDR = 'rtsp://localhost:8554/cam'
|
||||
DEVICE_ADDR = 2
|
||||
|
||||
cam = cv2.VideoCapture(DEVICE_ADDR)
|
||||
|
||||
while True:
|
||||
result, image = cam.read()
|
||||
|
||||
cv2.imshow('Camera', image)
|
||||
|
||||
if cv2.waitKey(1) & 0xFF == ord('s'):
|
||||
cv2.imwrite('capture.png', image)
|
||||
|
||||
if cv2.waitKey(1) & 0xFF == ord('q'):
|
||||
break
|
||||
|
||||
cam.release()
|
||||
|
||||
cv2.destroyWindow('Camera')
|
||||
cv2.destroyAllWindows()
|
||||
Reference in New Issue
Block a user