Last active
December 27, 2019 15:33
-
-
Save raiever/3f2a63c8a5bf9ce836c76332d37f3789 to your computer and use it in GitHub Desktop.
[OpenCV] Streaming video from IP camera
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# opencv-python: 4.1.1.26 | |
# python: 3.7.3 | |
import cv2 | |
source = 'rtsp://admin:[email protected]/profile2/media.smp' | |
cap = cv2.VideoCapture(source) | |
if cap.isOpened(): | |
cv2.namedWindow("ip camera demo", cv2.WINDOW_AUTOSIZE) | |
while True: | |
ret_val, frame = cap.read() | |
frame = cv2.resize(frame, (640,360)) | |
cv2.imshow("ip camera demo", frame) | |
cv2.waitKey(10) | |
else: | |
print('camera open failed') | |
cap.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment