Skip to content

Instantly share code, notes, and snippets.

@vsanse
Created August 12, 2017 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsanse/8cf45f568950f320268ae93e67535749 to your computer and use it in GitHub Desktop.
Save vsanse/8cf45f568950f320268ae93e67535749 to your computer and use it in GitHub Desktop.
import cv2
video = cv2.VideoCapture('Town.avi')
while video.isOpened():
ret, frame = video.read()
# cvtColor in opencv is used to change colorspace
grayscale = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('Orignal', frame)
cv2.imshow('Gray', grayscale)
cv2.waitKey(1)
video.release()
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment