Created
February 27, 2019 14:51
-
-
Save towc/bf56645b21ec40200fb3174bd5c06061 to your computer and use it in GitHub Desktop.
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
import cv2 | |
cap = cv2.VideoCapture(0) | |
fourcc = cv2.VideoWriter_fourcc(*'MJPG') | |
out = cv2.VideoWriter('appsrc ! videoconvert ! gtksink', | |
fourcc, 20.0, (640, 480)) | |
while cap.isOpened(): | |
ret, frame = cap.read() | |
if ret: | |
# frame = cv2.flip(frame, 0) | |
out.write(frame) | |
cv2.imshow('frame', frame) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break | |
else: | |
break | |
cap.release() | |
out.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment