Ejemplo n.º 1
0
def copy_keyframes(project, _shots):
    key_frames_file_names = [
        image_filename(shot.keyframe.index) for shot in _shots
    ]
    copy_keyframe = lambda file_name: copy2(
        join(project.folder_path(Project.Folder.frames), file_name),
        join(project.folder_path(Project.Folder.keyframes), file_name))
    [copy_keyframe(file_name) for file_name in key_frames_file_names]
Ejemplo n.º 2
0
def run(project, shots, cluster_count):
	progress_bar = tqdm(total=len(shots), desc="colors")

	for shot in shots:
		filename = image_filename(shot.keyframe.index)
		image_path = path.join(project.folder_path(Project.Folder.keyframes), filename)

		shot.keyframe.colors = colors_from_image(image_path, cluster_count)
		progress_bar.update()

	progress_bar.close()

	return shots
Ejemplo n.º 3
0
def write_spatio_temporal_slices(project, shots):
    progress_bar = tqdm(total=len(shots), desc="spatio temporal slices")
    for shot in shots:
        slices = calculate_patio_temporal_slice(
            project.folder_path(Project.Folder.frames), shot)
        vis = np.concatenate(slices, axis=1)

        filename = image_filename(shot.id)
        path = os.path.join(project.folder_path(Project.Folder.spatio),
                            filename)
        cv2.imwrite(path, vis)
        progress_bar.update()

    progress_bar.close()
Ejemplo n.º 4
0
def calculate_patio_temporal_slice(base_path, shot):
    cropped_images = []
    for index in range(shot.start_index, shot.end_index):
        filename = image_filename(index)
        path = join(base_path, filename)
        image = cv2.imread(path)

        shape = image.shape
        y = 0
        x = shape[1] // 2
        width = 1
        height = shape[0]

        cropped_image = image[y:y + height, x:x + width]
        resize_image = cv2.resize(cropped_image, (cropped_image.shape[1], 50))
        cropped_images.append(resize_image)

    return cropped_images
Ejemplo n.º 5
0
 def shot_to_keyframe_path(shot):
     index = shot.keyframe.index
     filename = utils.image_filename(index)
     return path.join(project.folder_path(Project.Folder.keyframes),
                      filename)