fix video viz bgr
这个提交包含在:
@ -99,7 +99,7 @@ def save_videos(video, dt, video_path=None):
|
|||||||
images = []
|
images = []
|
||||||
for cam_name in cam_names:
|
for cam_name in cam_names:
|
||||||
image = image_dict[cam_name]
|
image = image_dict[cam_name]
|
||||||
# image = image[:, :, [2, 1, 0]] # swap B and R channel
|
image = image[:, :, [2, 1, 0]] # swap B and R channel
|
||||||
images.append(image)
|
images.append(image)
|
||||||
images = np.concatenate(images, axis=1)
|
images = np.concatenate(images, axis=1)
|
||||||
out.write(images)
|
out.write(images)
|
||||||
@ -119,7 +119,7 @@ def save_videos(video, dt, video_path=None):
|
|||||||
out = cv2.VideoWriter(video_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h))
|
out = cv2.VideoWriter(video_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h))
|
||||||
for t in range(n_frames):
|
for t in range(n_frames):
|
||||||
image = all_cam_videos[t]
|
image = all_cam_videos[t]
|
||||||
# image = image[:, :, [2, 1, 0]] # swap B and R channel
|
image = image[:, :, [2, 1, 0]] # swap B and R channel
|
||||||
out.write(image)
|
out.write(image)
|
||||||
out.release()
|
out.release()
|
||||||
print(f'Saved video to: {video_path}')
|
print(f'Saved video to: {video_path}')
|
||||||
@ -165,15 +165,15 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
output_dataset_dir = args.dataset_dir + '_compressed'
|
output_dataset_dir = args.dataset_dir # + '_compressed'
|
||||||
os.makedirs(output_dataset_dir, exist_ok=True)
|
# os.makedirs(output_dataset_dir, exist_ok=True)
|
||||||
|
|
||||||
# Iterate over each file in the directory
|
# # Iterate over each file in the directory
|
||||||
for filename in tqdm(os.listdir(args.dataset_dir), desc="Compressing data"):
|
# for filename in tqdm(os.listdir(args.dataset_dir), desc="Compressing data"):
|
||||||
if filename.endswith('.hdf5'):
|
# if filename.endswith('.hdf5'):
|
||||||
input_path = os.path.join(args.dataset_dir, filename)
|
# input_path = os.path.join(args.dataset_dir, filename)
|
||||||
output_path = os.path.join(output_dataset_dir, filename)
|
# output_path = os.path.join(output_dataset_dir, filename)
|
||||||
compress_dataset(input_path, output_path)
|
# compress_dataset(input_path, output_path)
|
||||||
|
|
||||||
# After processing all datasets, load and save the video for the first episode
|
# After processing all datasets, load and save the video for the first episode
|
||||||
print(f'Saving video for episode 0 in {output_dataset_dir}')
|
print(f'Saving video for episode 0 in {output_dataset_dir}')
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户