Umgekehrtes Spektrogramm A La Aphex Twin in MATLAB
Ich versuche, ein Bild in MATLAB in ein Audiosignal umzuwandeln, indem ich es als Spektrogramm behandlewie in Aphex Twin's Song aufFenster Lecker. Leider habe ich Probleme, ein Ergebnis zu bekommen.
Hier ist was ich im Moment habe:
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
Also mache ich inverse Fourier-Transformationen an Spalten meines Bildes und füge sie dann zu einem Signal zusammen. Diese Funktion verwendet auch die Image Processing Toolbox für MATLAB, um Bilder einzulesen. Das Ziel ist eine Variation von
spectrogram(imagetosignal('image', 'bmp'));
Ergebnis in etwas, das wie das Originalbild aussieht. Ich würde mich über jede Hilfe sehr freuen! Ich lerne gerade die Signalverarbeitung, also wundere dich nicht, wenn es ein offensichtliches Missverständnis gibt. Vielen Dank!
Bearbeiten: Danke Dave! Ich habe es geschafft! Ich endete damit:
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