Пример #1
0
ground_truth_normals.view_new(channel=0)
# reconstructed_normals_horn.view_new(channel=0)

# <codecell>

temp_texture = np.concatenate([warped_intensity_image.pixels] * 3, axis=2)

# <codecell>

# <codecell>

from surface_reconstruction import frankotchellappa

# If we use gradient fields then we don't need to negate the x-axis
recovered_depth = frankotchellappa(-worthington.pixels[:, :, 0], worthington.pixels[:, :, 1])
recovered_depth_image = DepthImage((recovered_depth - np.min(recovered_depth)))
recovered_depth_image.view_new(mode="mesh")

# <codecell>

ground_truth_depth = frankotchellappa(ground_truth_normals.pixels[:, :, 0], ground_truth_normals.pixels[:, :, 1])
ground_truth_depth_image = DepthImage(
    (ground_truth_depth - np.min(ground_truth_depth)) / 1.3, texture=RGBImage(temp_texture)
)
ground_truth_depth_image.view_new(mode="mesh")

# <codecell>

# <codecell>
Пример #2
0
from pybug.image import DepthImage, RGBImage

ground_truth_normals.view_new(channel=0)
# reconstructed_normals_horn.view_new(channel=0)

# <codecell>

temp_texture = np.concatenate([warped_intensity_image.pixels] * 3, axis=2)

# <codecell>

# <codecell>

from surface_reconstruction import frankotchellappa
# If we use gradient fields then we don't need to negate the x-axis
recovered_depth = frankotchellappa(-worthington.pixels[:, :, 0],
                                   worthington.pixels[:, :, 1])
recovered_depth_image = DepthImage((recovered_depth - np.min(recovered_depth)))
recovered_depth_image.view_new(mode='mesh')

# <codecell>

ground_truth_depth = frankotchellappa(ground_truth_normals.pixels[:, :, 0],
                                      ground_truth_normals.pixels[:, :, 1])
ground_truth_depth_image = DepthImage(
    (ground_truth_depth - np.min(ground_truth_depth)) / 1.3,
    texture=RGBImage(temp_texture))
ground_truth_depth_image.view_new(mode='mesh')

# <codecell>

# <codecell>
Пример #3
0
    # Constrain to mask
    ground_truth_images.constrain_mask_to_landmarks(
        group='ibug_68_closed_mouth', label='all')
    intensity_image.constrain_mask_to_landmarks(
        group='ibug_68_closed_mouth', label='all')
    intensity_image.crop_to_landmarks(group='ibug_68_closed_mouth',
                                      label='all', boundary=2)
    ground_truth_images.crop_to_landmarks(group='ibug_68_closed_mouth',
                                          label='all', boundary=2)

    temp_texture = subject_images[sfs_index]

    # Perform Photometric Stereo
    ground_truth_normals, ground_truth_albedo = ps(ground_truth_images, lights)
    ground_truth_depth = frankotchellappa(-ground_truth_normals.pixels[:, :, 0],
                                          ground_truth_normals.pixels[:, :, 1])
    ground_truth_depth_image = DepthImage((ground_truth_depth - np.min(ground_truth_depth)) / 2,
                                          texture=temp_texture)
    normals[subject_id]['ground_truth'] = ground_truth_normals

    # TODO: save images
    #ground_truth_depth_image.view(mode='mesh')
    #save_result_images(subject_id, 'all', 'groundtruth')

    for k, feature_space in enumerate(feature_spaces):
        print "Running {0} for {1}".format(feature_space, subject_id)
        model_path = '/vol/atlas/pts08/cvpr/frgc_spring2003_sfs_tps_{0}_{1}.pkl'.format(subject_id, feature_space)
        with open(model_path, 'rb') as f:
            model = cPickle.load(f)

        normal_model = model['appearance_model']
Пример #4
0
    # Label with correct labels
    labeller([ground_truth_images, intensity_image],
             'PTS', ibug_68_closed_mouth)

    # Constrain to mask
    ground_truth_images.constrain_mask_to_landmarks(
        group='ibug_68_closed_mouth', label='all')
    intensity_image.constrain_mask_to_landmarks(
        group='ibug_68_closed_mouth', label='all')

    temp_texture = RGBImage(np.dstack([subject_images[0].pixels] * 3))

    # Perform Photometric Stereo
    ground_truth_normals, ground_truth_albedo = ps(ground_truth_images, lights)
    ground_truth_depth = frankotchellappa(ground_truth_normals.pixels[:, :, 0],
                                          ground_truth_normals.pixels[:, :, 1])
    ground_truth_depth_image = DepthImage((ground_truth_depth - np.min(ground_truth_depth)),
                                          texture=temp_texture,
                                          mask=intensity_image.mask)
    normals[subject_id]['ground_truth'] = ground_truth_normals

    # TODO: save images
    #ground_truth_depth_image.view(mode='mesh')
    #save_result_images(subject_id, 'all', 'groundtruth')

    for k, feature_space in enumerate(feature_spaces):
        print "Running {0} for {1}".format(feature_space, subject_id)
        model_path = '/vol/atlas/pts08/cvpr/frgc_spring2003_sfs_tps_{0}_{1}.pkl'.format(subject_id, feature_space)
        with open(model_path, 'rb') as f:
            model = cPickle.load(f)