我正试图将图像转换为音频信号,将其视为谱图as in Aphex Twin's song on Windowlicker。不幸的是,我无法获得结果。逆向频谱图在MATLAB中的La Aphex Twin
这是我目前所面对的:
function signal = imagetosignal(path, format)
% Read in the image and make it symmetric.
image = imread(path, format);
image = [image; flipud(image)];
[row, column] = size(image);
signal = [];
% Take the ifft of each column of pixels and piece together the real-valued results.
for i = 1 : column
spectrogramWindow = image(:, i);
R = abs(ifft(spectrogramWindow));
% Take only the results for the positive frequencies.
signalWindow = R(1 : row/2.0);
signal = [signal; signalWindow];
end
end
所以,我走我的图像列逆傅立叶变换,然后把它们放在一起,形成一个信号。此外,此功能使用MATLAB的图像处理工具箱来读取图像。我们的目标是有一些变化
spectrogram(imagetosignal('image', 'bmp'));
导致东西看起来像原始图像。我非常感谢任何帮助!我只是在学习信号处理,所以如果存在明显的误解,请不要感到惊讶。谢谢!
编辑:感谢戴夫!我得到它的工作!我结束了这一点:
function signal = imagetosignal(path, format)
% Read in the image and make it symmetric.
image = imread(path, format);
image = [image; flipud(image)];
[row, column] = size(image);
signal = [];
% Take the ifft of each column of pixels and piece together the results.
for i = 1 : column
spectrogramWindow = image(:, i);
signalWindow = real(ifft(spectrogramWindow));
signal = [signal; signalWindow];
end
end
那么,究竟是什么问题呢? – gnovice 2009-08-05 03:24:37
在回来的路上,图像的上半部分被有效地丢失了,并且可怕的东西仍然会留下污迹。 – 2009-08-05 03:33:53