Mat 201A Winter Jacob Burrows
%pylab inline
from __future__ import print_function
from __future__ import division
from IPython.display import Audio
Populating the interactive namespace from numpy and matplotlib
from scipy.io import wavfile
img = imread('tacos.jpg')
imshow(img)
<matplotlib.image.AxesImage at 0xc2045b0>
img.dtype
dtype('uint8')
img.shape
(800, 1200, 3)
img = img.astype(float).sum(axis=-1)/3
print(img.shape)
(800, 1200)
# imshow(img,cmap=cm.gray)
#forloop
X = []
for oneRow in img:
mag_spec = oneRow
# phs_spec = [0, 0, 0, pi/2,0,0,0,0,0]
# X = [np.complex(cos(phs)* mag, -sin(phs)* mag) for mag, phs in zip(mag_spec, phs_spec)]
x = fft.irfft(mag_spec)
#result stored in variable
X.append(x)
#converts list to array
X=array(X)
#each row of matrix are now parallel
X=X.flatten()
print(X.shape)
# plot(x, 'o-')
(1918400,)
plot(X)
xlabel("time")
ylabel("magnitude")
title("Output Wave")
plot(X)
Audio(data = X, rate=41000)