Skip to content

Instantly share code, notes, and snippets.

@AlejoCR
Created August 28, 2019 04:23
Show Gist options
  • Save AlejoCR/cbda47b5b6340d7f437484a9bdebf46b to your computer and use it in GitHub Desktop.
Save AlejoCR/cbda47b5b6340d7f437484a9bdebf46b to your computer and use it in GitHub Desktop.
import cv2
from PIL import Image
video_capture = cv2.VideoCapture(get_jetson_gstreamer_source(), cv2.CAP_GSTREAMER)
if not (video_capture.isOpened()):
print("Could not open video device")
#To set the resolution
while(True):
# Capture frame-by-frame
ret, frame = video_capture.read()
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
# Display the resulting frame
cv2.imshow('Video', frame)
#Waits for a user input to quit the application
if cv2.waitKey(1) & 0xFF == ord('q'):
cv2.imwrite('test-images/proyecto2.png', frame)
break
# When everything done, release the capture
video_capture.release()
cv2.destroyAllWindows()
im = Image.open("test-images/proyecto2.png")
rgb_im = im.convert('RGB')
rgb_im.save('test-images/proyecto2.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment