How to Read Video Δ°n Opencv Python
The following code is used to read video in OpenCV python. The process of reading video in OpenCV is very similar to reading images. The video is a series of images. All frames in a video sequence must be looped over and then rendered one frame at a time.
import cv2
capture = cv2.VideoCapture('video.mp4')
while(capture.isOpened()):
r, f = capture.read()
gray = cv2.cvtColor(f, cv2.COLOR_BGR2GRAY)
cv2.imshow('video',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
capture.release()
cv2.destroyAllWindows()
Comments
Post a Comment