Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed black disparity map problem #87

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion load_llff.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ def min_line_dist(rays_o, rays_d):
def load_llff_data(basedir, factor=8, recenter=True, bd_factor=.75, spherify=False, path_zflat=False):


poses, bds, imgs = _load_data(basedir, factor=factor) # factor=8 downsamples original imgs by 8x
# poses, bds, imgs = _load_data(basedir, factor=factor) # factor=8 downsamples original imgs by 8x
poses, bds, imgs = _load_data(basedir, width=1024, height=576)
print('Loaded', basedir, bds.min(), bds.max())

# Correct rotation matrix ordering and move variable dim to axis 0
Expand Down
15 changes: 13 additions & 2 deletions run_nerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def config_parser():
help='frequency of weight ckpt saving')
parser.add_argument("--i_testset", type=int, default=50000,
help='frequency of testset saving')
parser.add_argument("--i_video", type=int, default=50000,
parser.add_argument("--i_video", type=int, default=50000,
help='frequency of render_poses video saving')

return parser
Expand Down Expand Up @@ -803,10 +803,21 @@ def train():
# Turn on testing mode
with torch.no_grad():
rgbs, disps = render_path(render_poses, hwf, K, args.chunk, render_kwargs_test)
rgbs_render, disps_render = render_path(poses, hwf, K, args.chunk, render_kwargs_test)
print('Done, saving', rgbs.shape, disps.shape)
moviebase = os.path.join(basedir, expname, '{}_spiral_{:06d}_'.format(expname, i))
imageio.mimwrite(moviebase + 'rgb.mp4', to8b(rgbs), fps=30, quality=8)
imageio.mimwrite(moviebase + 'disp.mp4', to8b(disps / np.max(disps)), fps=30, quality=8)
imageio.mimwrite(moviebase + 'disp.mp4', to8b(disps / np.nanmax(disps)), fps=30, quality=8)

photodir = os.path.join(basedir, expname, 'rendered images')
os.makedirs(photodir, exist_ok=True)
photobase = os.path.join(photodir, '{}_{:06d}'.format(expname, i))
os.makedirs('{}/rgbs'.format(photobase), exist_ok=True)
os.makedirs('{}/disp'.format(photobase), exist_ok=True)
for index in range(len(rgbs_render)):
imageio.imwrite(photobase + '/rgbs/{:04d}'.format(index+7) + '.jpg', to8b(rgbs_render[index]))
imageio.imwrite(photobase + '/disp/{:04d}'.format(index+7) + '.jpg', to8b(disps_render[index] / np.nanmax(disps_render)))


# if args.use_viewdirs:
# render_kwargs_test['c2w_staticcam'] = render_poses[0][:3,:4]
Expand Down