MATLAB中的反向谱图ALa AphexTwin

我试图将图像转换为 MATLAB 中的音频信号,将其视为光谱图as in Aphex Twin's song onWindowlicker。不幸的是,我无法获得结果。

我试图将图像转换为 MATLAB 中的音频信号,将其视为光谱图as in Aphex Twin's song on Windowlicker。不幸的是,我无法获得结果。

这是我目前拥有的:

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'));

result in something that looks like the original image.I would very much appreciate any help!I ’ m just learning signal processing,so don ’ t be surprised if there ’ s an obvious misconception.Thanks!

编辑:谢谢戴夫!我得到了它的工作!我结束了这个:

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

alt text alt text

6

这里有一些小的误解。

我将按照发生的顺序而不是严重性来处理问题:

1)在计算 spectrogramWindow(图像)时出现一个错误

第一个数组条目应该是 0Hz 的分量,下一个是 N Hz。数组的最后一个元素应该是-N Hz 的分量。但是,您已经计算了 0Hz。

我不确定 matlab 语法,但是如果你像你一样翻转图像,然后在将其附加到原始之前剥离顶部和底部的行,你应该设置

或者,你可以考虑不附加图像本身,并从图像中提取光谱窗口后,应用一些功能,使其 Hermitian 对称。

2)服用 IFT 的腹肌。不需要。不要那样做。

如果 iFFT 得到正确的输入,你从 iFFT 中得到的是完全真实的。

你看到的是复杂的值,因为输入不是 ACTUALLY Hermitian 对称的,如上所述。永远不要使用 Abs ()。如果你必须作弊,提取 Real 部分,它不会从虚构的组件中折叠成垃圾。

3)你扔掉信号的后半部分。

一旦你从 iFFT 得到输出,它就代表了你所要求的信号。不要用频率来考虑它,它现在是一个音频时间序列。保留整个东西。

这是我如何看待它:

spectrogramWindow = image(:, i);
spectrogramWindow = [spectrogramWindow;reverse(spectrogramWindow(skip first and last))]
signalWindow = ifft(spectrogramWindow);
signal = [signal; signalWindow];
1

只是研究完全相同的东西,发现这个 perl 脚本。我想你可能会喜欢这个链接。

http://devrand.org/show_item.html?item=64&page=Project

本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处

(480)
在 ReactJs中设置组件内部的状态
上一篇
在 golang中定义一种新的时间类型
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(73条)