rsax commited on
Commit
3ed0fbb
·
verified ·
1 Parent(s): 170b8f2

Update visualization/plot_3d_global.py

Browse files
Files changed (1) hide show
  1. visualization/plot_3d_global.py +7 -10
visualization/plot_3d_global.py CHANGED
@@ -94,16 +94,13 @@ def plot_3d_motion(args, figsize=(10, 10), fps=120, radius=4):
94
  ax.set_yticklabels([])
95
  ax.set_zticklabels([])
96
 
97
- if out_name:
98
- plt.savefig(out_name, dpi=96)
99
- # plt.close()
100
- else:
101
- io_buf = io.BytesIO()
102
- plt.savefig(io_buf, format='png', dpi=96)
103
- io_buf.seek(0)
104
- img = Image.open(io_buf)
105
- frame = np.array(img)
106
- io_buf.close()
107
 
108
  plt.close(fig)
109
  return frame
 
94
  ax.set_yticklabels([])
95
  ax.set_zticklabels([])
96
 
97
+ # Adjusting frame output for GIF compatibility
98
+ io_buf = io.BytesIO()
99
+ plt.savefig(io_buf, format='png', dpi=96)
100
+ io_buf.seek(0)
101
+ img = Image.open(io_buf)
102
+ frame = np.array(img.convert('RGB'), dtype=np.uint8) # Ensure correct data type and remove alpha channel if present
103
+ io_buf.close()
 
 
 
104
 
105
  plt.close(fig)
106
  return frame