필터 지우기
필터 지우기

Converting 1d signal to 2d image

조회 수: 41 (최근 30일)
Kamila Jankowska
Kamila Jankowska 2022년 12월 15일
댓글: Image Analyst 2023년 7월 26일
Hello,
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.

답변 (2개)

Abderrahim. B
Abderrahim. B 2022년 12월 15일
Hello!
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
Image Analyst
Image Analyst 2022년 12월 15일
The how do you get the image from the spectrogram axes? Use getimage or getframe?

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2022년 12월 15일
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
PRASANTA KUMAR MOHANTY
PRASANTA KUMAR MOHANTY 2023년 7월 25일
Dear Image Analyst,
Will the reshaping of the original signal retain the all the information of the original one?
Image Analyst
Image Analyst 2023년 7월 26일
Yes. No information is lost.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by