I can display an image file fine after setting the DISPLAY variable but when I try to run the following video code from the opencv site , I get nothing , no video window is opened ? the demo I am following is :
http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html
please see the code and the output below :
[root@hadoop1 basic-motion-detection]# more demo1.py
import numpy as np
import cv2
cap = cv2.VideoCapture('/home/admin/example_02.mp4')
print cap.get(5) #to display frame rate of video
#print cap.get(cv2.cv.CV_CAP_PROP_FPS)
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) #convert to grayscale
cv2.imshow('frame',gray)
waitKey(50)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
[root@hadoop1 basic-motion-detection]# python demo1.py
0.0
[root@hadoop1 basic-motion-detection]#