티스토리 뷰

전에 코드는 잘이해안갔는데, 이건 바로 이해감. https://github.com/zju3dv/neuralbody/blob/master/lib/utils/if_nerf/if_nerf_data_utils.py

def get_near_far(bounds, ray_o, ray_d):
    """calculate intersections with 3d bounding box"""
    norm_d = np.linalg.norm(ray_d, axis=-1, keepdims=True)
    viewdir = ray_d / norm_d
    viewdir[(viewdir < 1e-5) & (viewdir > -1e-10)] = 1e-5
    viewdir[(viewdir > -1e-5) & (viewdir < 1e-10)] = -1e-5
    tmin = (bounds[:1] - ray_o[:1]) / viewdir
    tmax = (bounds[1:2] - ray_o[:1]) / viewdir
    t1 = np.minimum(tmin, tmax)
    t2 = np.maximum(tmin, tmax)
    near = np.max(t1, axis=-1)
    far = np.min(t2, axis=-1)
    mask_at_box = near < far
    near = near[mask_at_box] / norm_d[mask_at_box, 0]
    far = far[mask_at_box] / norm_d[mask_at_box, 0]
    return near, far, mask_at_box

'Research (연구 관련)' 카테고리의 다른 글

DP vs DDP  (0) 2021.08.13
osmesa, pyrender, torch training bug  (0) 2021.08.13
novel view synthesis, virtual camera  (1) 2021.08.05
voxelnerf command 짜투리  (0) 2021.08.03
erosion, dilation  (0) 2021.08.01
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함