我是python和matplotlib的新手,我想可视化/比较以txt格式存储为numpy数组的3个mfcc文件。
我有下面的Octave代码,我想知道如何使用python/matplotlib来完成它。
任何帮助都是非常感谢的。
load /dir/k11.txt
load /dir/t11.txt
load /dir/a11.txt
subplot(1,2,1);imagesc(j11);axis('xy');colormap(jet);colorbar;subplot(1,2,2);imagesc(t11);axis('xy');colormap(jet);colorbar;
c=[k11(:,end),k11(:,1:end-1)];
figure(1);
Ncep=size(c,2)-1;
a=real(fft([c,zeros(size(c,1),512-Ncep*2-1),c(:,end:-1:2)]'));
imagesc(a(1:end/2,:));
axis('xy');
colormap(jet);
c=t11;
figure(2);
Ncep=size(c,2)-1;
a=real(fft([c,zeros(size(c,1),512-Ncep*2-1),c(:,end:-1:2)]'));
imagesc(a(1:end/2,:));
axis('xy');
colormap(jet);
c=a11;
figure(3);
Ncep=size(c,2)-1;
a=real(fft([c,zeros(size(c,1),512-Ncep*2-1),c(:,end:-1:2)]'));
imagesc(a(1:end/2,:));
axis('xy');
colormap(jet);发布于 2021-02-26 00:08:54
很明显,你的例子有外部性,所以我不能直接重现它,但一般来说,这里是一个八度的例子,它的等效的python例子使用了你所需要的图像特性。
在Octave中
% Read an image from a url
Url = 'https://raw.githubusercontent.com/utkuozbulak/singular-value-decomposition-on-images/master/data/grayscale_cat.jpg';
A = imread( Url );
imagesc( A ); % Show image in 'colour-scaled' form
axis xy % Reverse the origin of the y-axis
colormap( jet ); % Choose the jet colormap在Python3中
import urllib.request # needed for reading urls
import matplotlib.pyplot as plt # needed for imread/imshow
import matplotlib.colors as cl # needed for colour-scaling
# Read an image from a url
Url = urllib.request.urlopen( 'https://raw.githubusercontent.com/utkuozbulak/singular-value-decomposition-on-images/master/data/grayscale_cat.jpg' )
A = plt.imread( Url, 'jpg' )
plt.imshow( A, # Create a pyplot 'image' instance
norm = cl.Normalize(), # Choose colour-scaled form
origin = 'lower', # Reverse the origin of the y-axis
cmap = 'jet' # Choose the jet colormap
)
plt.show()https://stackoverflow.com/questions/66371357
复制相似问题