Skip to content

Instantly share code, notes, and snippets.

@ayubmetah
Created January 24, 2021 21:52
Show Gist options
  • Save ayubmetah/ad16cfa6074e4f07af3eb14d065e3d24 to your computer and use it in GitHub Desktop.
Save ayubmetah/ad16cfa6074e4f07af3eb14d065e3d24 to your computer and use it in GitHub Desktop.
Reading Images and Videos with Python Open CV
import cv2 as cv
#Reading Images
# img = cv.imread('photos/kids.jpg')
# cv.imshow('Kids', img)
# cv.waitKey(0)
#Reading Videos
capture = cv.VideoCapture('video.mp4')
while True:
isTrue, frame = capture.read()
cv.imshow('Video', frame)
if cv.waitKey(30) & 0xFF == ord('d'):
break
capture.release()
cv.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment