def get_view_frustum(min_depth, max_depth, size, cam_intr, c2w):
    """Get corners of 3D camera view frustum of depth image
    """
    device = cam_intr.device
    im_h, im_w = size
    im_h = int(im_h)
    im_w = int(im_w)
    view_frust_pts = torch.stack([
        (torch.tensor([0, 0, im_w, im_w, 0, 0, im_w, im_w]).to(device) - cam_intr[0, 2]) * torch.tensor(
            [min_depth, min_depth, min_depth, min_depth, max_depth, max_depth, max_depth, max_depth]).to(device) /
        cam_intr[0, 0],
        (torch.tensor([0, im_h, 0, im_h, 0, im_h, 0, im_h]).to(device) - cam_intr[1, 2]) * torch.tensor(
            [min_depth, min_depth, min_depth, min_depth, max_depth, max_depth, max_depth, max_depth]).to(device) /
        cam_intr[1, 1],
        torch.tensor([min_depth, min_depth, min_depth, min_depth, max_depth, max_depth, max_depth, max_depth]).to(
            device)
    ])
    view_frust_pts = view_frust_pts.type(torch.float32)
    c2w = c2w.type(torch.float32)
    view_frust_pts = rigid_transform(view_frust_pts.T, c2w).T
    return view_frust_pts
Get corners of 3D camera view frustum of depth image
    
mv-diffusion/One-2-3-45/reconstruction/data/scene.py