Professional Documents
Culture Documents
EdonSeanDarwin CPET522b T01 HW02
EdonSeanDarwin CPET522b T01 HW02
March 6, 2020
CPE51
# frame
currentframe = 0
while(True):
if ret:
# if video is still left continue creating
images
name = './data/frame' +
str(currentframe) + '.jpg'
print ('Creating...' + name)
def if __name__=="__main__":
convert_frames_to_video(pathIn,pathOut,fp main()
s):
frame_array = []
files = [f for f in os.listdir(pathIn) if
isfile(join(pathIn, f))]
for i in range(len(files)):
filename=pathIn + files[i]
#reading each files
img = cv2.imread(filename)
height, width, layers = img.shape
size = (width,height)
print(filename)
#inserting the frames into an image
array
frame_array.append(img)
out =
cv2.VideoWriter(pathOut,cv2.VideoWriter
_fourcc(*'DIVX'), fps, size)
for i in range(len(frame_array)):
# writing to a image array
out.write(frame_array[i])
out.release()