import numpy as np
import cv2
import os
import time
import datetime
from threading import Timer
from threading import Thread
def showVideo(capl, secs):
time.sleep(secs)
try:
print("start video")
while(capl.isOpened()):
ret, frame = capl.read()
cv2.namedWindow('frames', cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty('frames', cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
try:
cv2.imshow('frames',frame)
print("imshow")
except:
break
if cv2.waitKey(50) & 0xFF == ord('q'):
break
capl.release()
cv2.destroyAllWindows()
print("End video")
except Exception as e:
print(e)
def bootProgramm():
fileList = os.listdir('source/')
getLength = len(fileList)
i= 0
print(fileList)
while (i <= (getLength - 1)):
print(fileList[i])
#secs = 10
#print(secs)
x=datetime.datetime.now()
y=x.replace(year=2018, month=10, day=9, hour=14, minute=(46+i), second=0, microsecond=0)
delta_t = y - x
secs = delta_t.seconds+1
capl = cv2.VideoCapture('source/'+fileList[i])
#showVideo(capl, secs)
Thread(target = showVideo, args = (capl, secs)).start()
#Timer(secs, showVideo, [capl]).start()
i=i+1
bootProgramm()
这是密码。只有第一个视频正在播放,我没有看到任何错误。为什么它在树莓里不起作用?同样的程序在Windows中运行良好,但在raspberry中却不行。有人知道为什么吗?请帮帮我,我已经困了好几天了。非常感谢。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐