Exemplo n.º 1
0
def vis(camera_location, ray_directions, intersections, normals, hit, missed,
        sdf_vals, coords, pixel_colors, hit_pixels, missed_pixels):
    import sdf_renderer.vis as vis
    # import matplotlib.pyplot as plt
    # pixel_colors[np.logical_not(hit_pixels)] = 0
    # plt.imshow(pixel_colors, cmap=None if is_rgb else 'gray')
    from PIL import Image
    if not is_rgb:
        pixel_colors = np.stack([pixel_colors] * 3, axis=-1)
    pixel_colors[pixel_colors > 1] = 1
    pixel_colors[pixel_colors < 0] = 0
    # pixel_colors /= np.max(pixel_colors)
    pixel_colors = (pixel_colors * 255).astype(np.uint8)
    Image.fromarray(pixel_colors).resize((255, 255)).show()

    # plt.show(block=False)
    print(camera_location.shape)
    print(ray_directions.shape)
    vis.vis_rays(camera_location, ray_directions[::8])
    vis.vis_points(intersections[hit], scale_factor=0.02, color=(0, 1, 0))
    vis.vis_points(intersections[missed], scale_factor=0.02, color=(0, 0, 1))

    vis.vis_points(intersections[np.logical_not(np.logical_or(hit, missed))],
                   scale_factor=0.02,
                   color=(1, 0, 0))
    vis.vis_normals(intersections[hit], normals[hit], color=(0, 0, 0))
    vis.vis_axes()
    vis.vis_contours(sdf_vals, coords)
    vis.show()
Exemplo n.º 2
0
def vis(offset, direction):
    from sdf_renderer.vis import vis_rays, vis_axes, vis_points, show

    offset = offset
    direction = direction
    vis_points(offset + direction, color=(1, 0, 0), scale_factor=0.05)
    vis_points(offset, scale_factor=0.1, color=(0, 0, 1))

    vis_axes()
    print(direction.shape)
    print(direction[:2, :2])
    vis_rays(offset, direction)

    show()
Exemplo n.º 3
0
def vis(camera_location, ray_directions, intersections, normals, hit, missed,
        sdf_vals, coords):
    import sdf_renderer.vis as vis
    vis.vis_rays(camera_location, ray_directions)
    vis.vis_points(intersections[hit], scale_factor=0.02, color=(0, 1, 0))
    vis.vis_points(intersections[missed], scale_factor=0.02, color=(0, 0, 1))
    vis.vis_points(intersections[np.logical_not(np.logical_or(hit, missed))],
                   scale_factor=0.02,
                   color=(1, 0, 0))

    vis.vis_normals(intersections[hit],
                    normals[hit],
                    color=(0, 0, 0),
                    opacity=0.2)
    vis.vis_axes()
    vis.vis_contours(sdf_vals, coords)
    vis.show()
Exemplo n.º 4
0
# t2 = -np.matmul(R.T, t)
# rays2 = np.matmul(rays0, R)
rays = np.matmul(rays0, R)

# dist = sphere_trace(tsdf.get_signed_distance, x, r)

# plt.figure()
depth[depth == invalid_depth] = 5000
# plt.imshow(depth)
# plt.show()
plt.figure()
plt.imshow(rgb)
plt.show(block=False)

vis.vis_axes()
# x, y, z = xyz.T
# t2 = -t2
print('t', t)
# t[1] *= 0
# t2[1] = 0.38
# t = np.matmul(R, t)

# x, y, z = xyz.T
z, y, x = xyz.T
# x, z, y = xyz.T
# z, x, y = xyz.T
# x *= -1
# y *= -1
# z *= -1
rays[..., 1] *= -1
Exemplo n.º 5
0
def vis(s, coords):
    import sdf_renderer.vis as vis
    vis.vis_contours(s, coords)
    vis.vis_axes()
    vis.show()