import cv2
import numpy as np
import os
DIR ='./output'
N =len([name for name in os.listdir(DIR)if os.path.isfile(os.path.join(DIR, name))])print(N)# N =
fourcc = cv2.VideoWriter_fourcc(*'XVID')
sz =(640,480)
fps=20
videoWrite=cv2.VideoWriter('input.avi',fourcc,fps,sz)for i inrange(0,N-1):
cap = cv2.imread('./output/{}.png'.format(str(i)))#fourcc= cv2.cv.FOURCC(*'XVID')
videoWrite.write(cap)#cv2.imshow("capture",cap)if cv2.waitKey(1)&0xFF==ord('q'):break
videoWrite.release()
cv2.destroyAllWindows()