Kai-46 / nerfplusplus

improves over nerf in 360 capture of unbounded scenes
BSD 2-Clause "Simplified" License
911 stars 101 forks source link

code for final rendering #27

Open kam1107 opened 3 years ago

kam1107 commented 3 years ago

Hi, Can you also provide the code for rendering the final video? Many thanks :)

Kai-46 commented 3 years ago

Once you render the camera path, you can use the following script to create a video.

import imageio
import os

render_dir = '/path/to/rendered/camera/path'

frames = []
fps = 10

for item in sorted(os.listdir(render_dir)):
    if item.endswith('.png'):
        im = imageio.imread(os.path.join(render_dir, item))
        frames.append(im)

# rewind
frames = frames + frames[::-1]

imageio.mimwrite(render_dir + '.mp4', frames, fps=fps)