Update visualization/plot_3d_global.py
Browse files
visualization/plot_3d_global.py
CHANGED
|
@@ -114,15 +114,21 @@ def draw_to_batch(smpl_joints_batch, title_batch=None, outname=None):
|
|
| 114 |
batch_size = len(smpl_joints_batch)
|
| 115 |
out = []
|
| 116 |
for i in range(batch_size):
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
gif_bytes = io.BytesIO()
|
| 119 |
imageio.mimsave(gif_bytes, frames, format='GIF', fps=120)
|
| 120 |
gif_bytes.seek(0)
|
|
|
|
| 121 |
gif_data = gif_bytes.getvalue()
|
| 122 |
out.append(gif_data)
|
| 123 |
print(f"Generated GIF for batch {i+1}/{batch_size}, size: {len(gif_data)} bytes")
|
| 124 |
return out
|
| 125 |
|
|
|
|
| 126 |
|
| 127 |
# if out_name is not None:
|
| 128 |
# plt.savefig(out_name, dpi=96)
|
|
|
|
| 114 |
batch_size = len(smpl_joints_batch)
|
| 115 |
out = []
|
| 116 |
for i in range(batch_size):
|
| 117 |
+
# Generate frames for the current batch item
|
| 118 |
+
frames = [plot_3d_motion([smpl_joints_batch[i], None, title_batch[i] if title_batch is not None else None]) for _ in range(frame_number)]
|
| 119 |
+
# Stack frames to create a sequence
|
| 120 |
+
frames = np.stack(frames, axis=0)
|
| 121 |
+
# Create a BytesIO object to save GIF
|
| 122 |
gif_bytes = io.BytesIO()
|
| 123 |
imageio.mimsave(gif_bytes, frames, format='GIF', fps=120)
|
| 124 |
gif_bytes.seek(0)
|
| 125 |
+
# Get the GIF data
|
| 126 |
gif_data = gif_bytes.getvalue()
|
| 127 |
out.append(gif_data)
|
| 128 |
print(f"Generated GIF for batch {i+1}/{batch_size}, size: {len(gif_data)} bytes")
|
| 129 |
return out
|
| 130 |
|
| 131 |
+
|
| 132 |
|
| 133 |
# if out_name is not None:
|
| 134 |
# plt.savefig(out_name, dpi=96)
|