2020-09-23 20:02:46 +00:00
|
|
|
import imageio
|
|
|
|
|
import numpy as np
|
2020-09-20 20:01:54 +00:00
|
|
|
class Exporter:
|
2020-09-23 20:02:46 +00:00
|
|
|
fps = 30
|
2020-09-24 13:47:49 +00:00
|
|
|
|
|
|
|
|
def __init__(self):
|
2020-09-23 20:02:46 +00:00
|
|
|
print("Exporter initiated")
|
2020-09-24 13:47:49 +00:00
|
|
|
|
|
|
|
|
def export(self, frames, outputPath):
|
2020-09-23 20:02:46 +00:00
|
|
|
fps = self.fps
|
|
|
|
|
writer = imageio.get_writer(outputPath, fps=fps)
|
2020-09-24 13:47:49 +00:00
|
|
|
for frame in frames:
|
2020-09-23 20:02:46 +00:00
|
|
|
writer.append_data(np.array(frame))
|
|
|
|
|
|
2020-09-24 13:47:49 +00:00
|
|
|
writer.close()
|