One frame capture

Dear OpenCV forum users,

Please say me how I can capture one of frames from RTSP stream?

import cv2
cap = cv2.VideoCapture()
cap.open(0, cv2.CAP_DSHOW)

while(True):
    ret, frame = cap.read()
    cv2.imshow('frame', frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

This example code create a window with video output, but I want a simple take one screenshot without saving it. Just preview.

Thanks

this whole forum is for OpenCV. your thread is already in the “Python” section. tagging cv2 is meaningless.

1 Like