Home OpenCV not playing video using cv2
Reply: 0

OpenCV not playing video using cv2

user757
1#
user757 Published in July 17, 2018, 7:53 am

I am trying to load a video from my hard drive convert the video into grayscale and then play the video using opencv with python 2.7. My code is as below

import numpy as np
import cv2

cap=cv2.VideoCapture("C:/Users/test/Desktop/Opencv/Crowded1.avi")

while (cap.isOpened()):
 ret, frame = cap.read()

 gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
 cv2.imshow('gray',gray)

 if cv2.waitKey(25) & 0xFF == ord('q'):
    break

cap.release()
cv2.destroyAllWindows()

Absolutley nothing happens at all when I run the file, I get zero errors but nothing pops up. Does anybody have any ideas on what I can do? I am following this tutorial https://docs.opencv.org/3.1.0/dd/d43/tutorial_py_video_display.html

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.326898 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO