Skip to content

Commit 459e38e

Browse files
committed
Bugfix for saving videos (red and blue flipped)
1 parent 0a45151 commit 459e38e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

echonet/utils/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ def savevideo(filename: str, array: np.ndarray, fps: typing.Union[float, int] =
7070
fourcc = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')
7171
out = cv2.VideoWriter(filename, fourcc, fps, (width, height))
7272

73-
for i in range(f):
74-
out.write(array[:, i, :, :].transpose((1, 2, 0)))
73+
for frame in array.transpose((1, 2, 3, 0)):
74+
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
75+
out.write(frame)
7576

7677

7778
def get_mean_and_std(dataset: torch.utils.data.Dataset,

0 commit comments

Comments
 (0)