Borrar filtros
Borrar filtros

Converting 1d signal to 2d image

28 visualizaciones (últimos 30 días)
Kamila Jankowska
Kamila Jankowska el 15 de Dic. de 2022
Comentada: Image Analyst el 26 de Jul. de 2023
I would like to ask how can I convert 1d signal to timeseries image, which will be used as CNN input?
Atatched schema is presenting this operation.

Respuestas (2)

Abderrahim. B
Abderrahim. B el 15 de Dic. de 2022
If i understood your question properly, you want to convert time series (signal is type of time series) to like-image to train CNN. See below:
% Generate signal
Fs = 2500 ;
F = [40 70 400]
F = 1×3
40 70 400
t = 0:1/Fs:2-1/Fs ; % 2 seconds
noisySig = 2.5*sum(cos(2*pi*F.'*t)) + randn(1, length(t)) ; % noisy signal
% convert to spectrogram
spectrogram(noisySig, Fs)
hope this helps
  1 comentario
Image Analyst
Image Analyst el 15 de Dic. de 2022
The how do you get the image from the spectrogram axes? Use getimage or getframe?

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 15 de Dic. de 2022
How about using reshape to make it into a 2-D matrix of the proper aspect ratio? Then use imresize to size it to the size your network requires. Like to get 227 rows from your signal:
reshapedSignal = reshape(originalSignal, 227, []);
reshapedSignal = imresize(reshapedSignal, [227, 227]); % 227 for Alexnet
  2 comentarios
PRASANTA KUMAR MOHANTY el 25 de Jul. de 2023
Dear Image Analyst,
Will the reshaping of the original signal retain the all the information of the original one?
Image Analyst
Image Analyst el 26 de Jul. de 2023
Yes. No information is lost.

Iniciar sesión para comentar.


Más información sobre Convert Image Type en Help Center y File Exchange.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by