Esempio n. 1
0
def get_render_array(file_dict, model_pts, depth_location):
    #camera matrix
    extrinsic_camera_matrix = pt2render.ex_camera_matrix(
        file_dict['azimuth'], file_dict['elevation'], file_dict['tilt'],
        file_dict['rho'])
    camera_matrix = pt2render.get_camera_matrix(
        variables.INTRINSIC_CAMERA_MATRIX, extrinsic_camera_matrix,
        variables.WORLD_MATRIX)
    #render
    pt_array = pt2render.get_render_location(model_pts, camera_matrix)

    # depth Map
    depth_map_name = get_depth_map_name(file_dict, depth_location)
    depth_map = get_depthmap_from_exr(depth_map_name)
    depth_truth, depth_pt_array = pt2render.depth_visibility_array(
        pt_array, depth_map)
    #print(depth_map_name)
    #print(depth_pt_array.shape)
    #crop
    crop_truth, crop_pt_array = pt2render.crop_visibility_array(
        pt_array, file_dict['crop_params'])
    #print(crop_pt_array.shape)
    #global_return
    global_truth = crop_truth * depth_truth
    return global_truth, crop_pt_array
Esempio n. 2
0
def get_3d_to_2d(model_pts, params):
    extrinsic_camera_matrix =  pt2render.ex_camera_matrix(params[0], params[1], params[2], params[3])
    camera_matrix = pt2render.get_camera_matrix(variables.INTRINSIC_CAMERA_MATRIX,extrinsic_camera_matrix,
                                      variables.WORLD_MATRIX)
    #render
    pt_array = pt2render.get_render_location(model_pts,camera_matrix)
    
    return pt_array
Esempio n. 3
0
def get_render_array_no_prune(file_dict, model_pts):
    #camera matrix
    extrinsic_camera_matrix = pt2render.ex_camera_matrix(
        file_dict['azimuth'], file_dict['elevation'], file_dict['tilt'],
        file_dict['rho'])
    camera_matrix = pt2render.get_camera_matrix(
        variables.INTRINSIC_CAMERA_MATRIX, extrinsic_camera_matrix,
        variables.WORLD_MATRIX)
    #render
    pt_array = pt2render.get_render_location(model_pts, camera_matrix)
    return pt_array
Esempio n. 4
0
def render_random_direction_depth_map(pt_array, size=(540, 960)):
    azi = np.rad2deg(2 * math.pi * np.random.uniform())
    z = np.random.uniform() - 0.001
    ele = np.rad2deg(np.arctan(z / math.sqrt(1 - z * z)))
    tilt = np.rad2deg(-math.pi / 8.0 + np.random.uniform() * math.pi / 4.0)
    rho = 3 + np.random.uniform()
    extrinsic_camera_matrix = pt2render.ex_camera_matrix(azi, ele, tilt, rho)
    camera_matrix = pt2render.get_camera_matrix(
        variables.INTRINSIC_CAMERA_MATRIX, extrinsic_camera_matrix,
        variables.WORLD_MATRIX)
    pt_array = pt2render.get_render_location(pt_array, camera_matrix)
    depth_map = get_pt_depth_map(pt_array, size)
    return depth_map