File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,9 @@ def plot_spectrogram_to_numpy(spectrogram):
142
142
fig .canvas .draw ()
143
143
try :
144
144
data = np .array (fig .canvas .renderer .buffer_rgba (), dtype = np .uint8 )
145
- data = data .reshape (fig .canvas .get_width_height ()[::- 1 ] + (4 ,))[:, :, :3 ] # 只取前三个通道(RGB)
145
+ data = data .reshape (fig .canvas .get_width_height ()[::- 1 ] + (4 ,))[
146
+ :, :, :3
147
+ ] # 只取前三个通道(RGB)
146
148
except :
147
149
data = np .fromstring (fig .canvas .tostring_rgb (), dtype = np .uint8 , sep = "" )
148
150
data = data .reshape (fig .canvas .get_width_height ()[::- 1 ] + (3 ,))
@@ -175,7 +177,9 @@ def plot_alignment_to_numpy(alignment, info=None):
175
177
fig .canvas .draw ()
176
178
try :
177
179
data = np .array (fig .canvas .renderer .buffer_rgba (), dtype = np .uint8 )
178
- data = data .reshape (fig .canvas .get_width_height ()[::- 1 ] + (4 ,))[:, :, :3 ] # 只取前三个通道(RGB)
180
+ data = data .reshape (fig .canvas .get_width_height ()[::- 1 ] + (4 ,))[
181
+ :, :, :3
182
+ ] # 只取前三个通道(RGB)
179
183
except :
180
184
data = np .fromstring (fig .canvas .tostring_rgb (), dtype = np .uint8 , sep = "" )
181
185
data = data .reshape (fig .canvas .get_width_height ()[::- 1 ] + (3 ,))
You can’t perform that action at this time.
0 commit comments