Skip to content

Instantly share code, notes, and snippets.

@wwj718
Created January 24, 2018 13:46
Show Gist options
  • Save wwj718/820baa92289a15618beb85ae48413889 to your computer and use it in GitHub Desktop.
Save wwj718/820baa92289a15618beb85ae48413889 to your computer and use it in GitHub Desktop.
# pip install opencv-python
# python3.6.2
#!/usr/bin/env python
# encoding: utf-8
import numpy as np
import cv2
cap = cv2.VideoCapture('/Users/wwj/Documents/pets.mp4')
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment