Esempio n. 1
0
    # Pass landmarks to all ground truth images
    ground_truth_images.landmarks['PTS'] = intensity_image.landmarks['PTS']

    # 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')
    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')
Esempio n. 2
0
    ground_truth_images.landmarks['PTS'] = intensity_image.landmarks['PTS']

    # 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')
    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