#opencv幻灯片代码
import cv2
import os

WAIT = 3000
os.chdir('../images')
file_list = os.listdir()

for i in range(len(file_list) - 1):
img1 = cv2.imread(file_list[i])
img2 = cv2.imread(file_list[i + 1])
src1 = cv2.resize(img1, (640, 480))
src2 = cv2.resize(img2, (640, 480))

for it in range(WAIT + 1):
if it % 100 == 0:
weight = it / WAIT
res = cv2.addWeighted(src1, 1 - weight, src2, weight, 0)
cv2.imshow('images', res)
cv2.waitKey(100)

cv2.waitKey(0)
cv2.destroyAllWindows()