opencv的cv2.imshow()无法正常显示视频解决办法

import cv2
video_path = ‘/home/zhex/Videos/test_video/outdoor/closed_head.mp4’
vid = cv2.VideoCapture(video_path)

if not vid.isOpened():
raise IOError(“couldn’t open the video”)

while True:
return_value,frame = vid.read()
if not return_value:
break
print('size = ',frame.shape)
cv2.imshow(‘frame’,frame)
cv2.waitKey(10) #一定要延时,否则不能正常显示

你可能感兴趣的:(CV)